Results 1 to 2 of 2
  1. #1
    lowlyintern is offline Member
    Join Date
    Jun 2010
    Posts
    13
    Rep Power
    0

    Default Another log4j problem

    Hey everyone,

    I'm looking to configure the properties file of log4j so a specific namespace doesn't use the ConsoleAppender. Here's what I have so far:

    Java Code:
    # Set root logger level to DEBUG and its only appender to A2.  Add A1 if you want to use the console. 
    log4j.logger.org.apache.activemq=WARN
    log4j.additivity.com.mikel.smart.metrics.envfilters.SeaState=False
    log4j.rootLogger=ALL, A1,  A2
    
    # A1 is set to be a ConsoleAppender. 
    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.Threshold=ALL
    
    # A1 uses PatternLayout.
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    log4j.appender.A1.layout.ConversionPattern=%-5p %c %x - %m%n
    
    # A2 is set to be a RollingFileAppender. 
    log4j.appender.A2=org.apache.log4j.RollingFileAppender 
    log4j.appender.A2.layout=org.apache.log4j.PatternLayout
    log4j.appender.A2.layout.ConversionPattern=%m%n
    log4j.appender.A2.File=/home/sean/NetBeansProjects/Metrics/metrics.log
    log4j.appender.A2.Threshold=ALL
    log4j.appender.A2.ImmediateFlush=true 
    log4j.appender.A2.Append=False 
    log4j.appender.A2.MaxFileSize=100MB
    log4j.appender.A2.MaxBackupIndex=5
    I would think that the additivity line would let me remove the appenders and I could add them back in at will, but it doesn't. Can anyone help me on this? Also, if there's an easier way to remove an appender from the properties file that would be great too. Thanks.

  2. #2
    lowlyintern is offline Member
    Join Date
    Jun 2010
    Posts
    13
    Rep Power
    0

    Default

    Got it, forgot to declare unique logger for SeaState. Here's all I needed:

    log4j.logger.com.mikel.smart.metrics.envfilters.Se aState=DEBUG, A2

Similar Threads

  1. log4j
    By swapna_d in forum New To Java
    Replies: 7
    Last Post: 08-04-2010, 01:23 AM
  2. problem with log4j
    By neha.shri in forum New To Java
    Replies: 1
    Last Post: 06-26-2009, 10:30 AM
  3. Log4j problem - Logs are rolling into the previous date file
    By vaibhavborole in forum Advanced Java
    Replies: 0
    Last Post: 04-16-2009, 04:33 PM
  4. log4j problem.
    By dheerajsea123 in forum Advanced Java
    Replies: 1
    Last Post: 12-10-2008, 09:33 AM
  5. Log4J, problem with Hibernate and Spring
    By Marcus in forum Advanced Java
    Replies: 1
    Last Post: 06-06-2007, 04: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
  •