Results 1 to 2 of 2
  1. #1
    neha.shri is offline Member
    Join Date
    Jun 2009
    Posts
    1
    Rep Power
    0

    Question problem with log4j

    Hi

    can you please tell me if in a package i have 2 files name Test1.java
    and Test2.java.

    I want Test1.java to give only info messages and Test2.java to give only debug messages.

    Is this possible using log4j.properties or log4j.xml or i have to define different log mechanisms for different files.

    Thanks in advance

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    6

    Default

    You need to create log4j.properties file where you write which class you want to info in the logs:
    Java Code:
    log4j.rootLogger=FATAL, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%t | %m%n
    ....here you write the path to your class....=INFO

Similar Threads

  1. Log4j problem - Logs are rolling into the previous date file
    By vaibhavborole in forum Advanced Java
    Replies: 0
    Last Post: 04-16-2009, 03:33 PM
  2. log4j problem.
    By dheerajsea123 in forum Advanced Java
    Replies: 1
    Last Post: 12-10-2008, 08:33 AM
  3. Regarding Log4j
    By sidiq in forum New To Java
    Replies: 0
    Last Post: 04-07-2008, 07:35 PM
  4. Log4j
    By chakri in forum New To Java
    Replies: 1
    Last Post: 02-08-2008, 10:15 PM
  5. Log4J, problem with Hibernate and Spring
    By Marcus in forum Advanced Java
    Replies: 1
    Last Post: 06-06-2007, 03:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •