Appenders Problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Appenders Problem

Luke-2
Hi All;

I would like to write to a specific file when logging from a specific class.

Below is my properties file. The class that needs the special behavior is in the model.notification package. It should be handled with the emailAppender, which in turn should only write INFO messages to the email.html file.

But what happens is email.html gets everything and fw.html gets everything plus some duplicate entries.

What am I doing wrong?

Thanks,

Luke


log4j.rootLogger=debug, generalAppender, emailAppender

#class specific loggin
log4j.category.model.notification=INFO, emailAppender
log4j.additivity.model.notification=false
log4j.category.beans=DEBUG, generalAppender
log4j.category.model=DEBUG, generalAppender
log4j.category.model.writers=DEBUG, generalAppender
log4j.category.servlet=DEBUG, generalAppender

#general appender properties
log4j.appender.generalAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.generalAppender.File= //usr/local/tomcat/logs/fw/fw.html
log4j.appender.generalAppender.MaxFileSize=100KB
log4j.appender.generalAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.generalAppender.MaxBackupIndex=3

#email appender properties
log4j.appender.emailAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.emailAppender.File= //usr/local/tomcat/logs/fw/email.html
log4j.appender.emailAppender.MaxFileSize=300KB
log4j.appender.emailAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.emailAppender.MaxBackupIndex=3

#general appender layout
log4j.appender.generalAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.generalAppender.layout.LocationInfo=true
log4j.appender.generalAppender.layout.Title=FW Application Log

#email appender layout
log4j.appender.emailAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.emailAppender.layout.LocationInfo=true
log4j.appender.emailAppender.layout.Title=FW Email Log
Reply | Threaded
Open this post in threaded view
|

Re: Appenders Problem

Luke-2
Responding to my own thread:

I made the change below to my props file and everything is fine now.

#general stuff
log4j.logger.model.notification=INFO, emailAppender
log4j.additivity.model.notification=false
log4j.logger.beans=DEBUG, generalAppender
log4j.logger.model=DEBUG, generalAppender
log4j.logger.model.writers=DEBUG, generalAppender
log4j.logger.servlet=DEBUG, generalAppender
#general appender properties
log4j.appender.generalAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.generalAppender.File= //usr/local/tomcat/logs/fw/fw.html
log4j.appender.generalAppender.MaxFileSize=100KB
log4j.appender.generalAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.generalAppender.MaxBackupIndex=3
#email appender properties
log4j.appender.emailAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.emailAppender.File= //usr/local/tomcat/logs/fw/email.html
log4j.appender.emailAppender.MaxFileSize=300KB
log4j.appender.emailAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.emailAppender.MaxBackupIndex=3
#general appender layout
log4j.appender.generalAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.generalAppender.layout.LocationInfo=true
log4j.appender.generalAppender.layout.Title=FW Application Log
#email appender layout
log4j.appender.emailAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.emailAppender.layout.LocationInfo=true
log4j.appender.emailAppender.layout.Title=FW Email Log

----- Original Message -----
From: "Luke" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 18, 2005 8:32 AM
Subject: Appenders Problem


Hi All;

I would like to write to a specific file when logging from a specific class.

Below is my properties file. The class that needs the special behavior is in
the model.notification package. It should be handled with the emailAppender,
which in turn should only write INFO messages to the email.html file.

But what happens is email.html gets everything and fw.html gets everything
plus some duplicate entries.

What am I doing wrong?

Thanks,

Luke


log4j.rootLogger=debug, generalAppender, emailAppender

#class specific loggin
log4j.category.model.notification=INFO, emailAppender
log4j.additivity.model.notification=false
log4j.category.beans=DEBUG, generalAppender
log4j.category.model=DEBUG, generalAppender
log4j.category.model.writers=DEBUG, generalAppender
log4j.category.servlet=DEBUG, generalAppender

#general appender properties
log4j.appender.generalAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.generalAppender.File= //usr/local/tomcat/logs/fw/fw.html
log4j.appender.generalAppender.MaxFileSize=100KB
log4j.appender.generalAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.generalAppender.MaxBackupIndex=3

#email appender properties
log4j.appender.emailAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.emailAppender.File= //usr/local/tomcat/logs/fw/email.html
log4j.appender.emailAppender.MaxFileSize=300KB
log4j.appender.emailAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.emailAppender.MaxBackupIndex=3

#general appender layout
log4j.appender.generalAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.generalAppender.layout.LocationInfo=true
log4j.appender.generalAppender.layout.Title=FW Application Log

#email appender layout
log4j.appender.emailAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.emailAppender.layout.LocationInfo=true
log4j.appender.emailAppender.layout.Title=FW Email Log



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Appenders Problem

Camuto, Matthew
In reply to this post by Luke-2
If you remove 'emailAppender' from your log4j.rootLogger config then
part of your problem should be fixed. I had a similar situation and used
the following code:

log4j.rootLogger=DEBUG, EXTERNAL

log4j.logger.internal=DEBUG,INTERNAL
log4j.additivity.internal=false

where I defined 2 separate appenders and every logger starting with the
string 'internal.'... would just go to the INTERNAL appender. I think
this
is similar to the problem you have now?

matt


-----Original Message-----
From: Luke [mailto:[hidden email]]
Sent: Wednesday, May 18, 2005 5:32 AM
To: [hidden email]
Subject: Appenders Problem

Hi All;

I would like to write to a specific file when logging from a specific
class.

Below is my properties file. The class that needs the special behavior
is in the model.notification package. It should be handled with the
emailAppender, which in turn should only write INFO messages to the
email.html file.

But what happens is email.html gets everything and fw.html gets
everything plus some duplicate entries.

What am I doing wrong?

Thanks,

Luke


log4j.rootLogger=debug, generalAppender, emailAppender

#class specific loggin
log4j.category.model.notification=INFO, emailAppender
log4j.additivity.model.notification=false
log4j.category.beans=DEBUG, generalAppender
log4j.category.model=DEBUG, generalAppender
log4j.category.model.writers=DEBUG, generalAppender
log4j.category.servlet=DEBUG, generalAppender

#general appender properties
log4j.appender.generalAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.generalAppender.File= //usr/local/tomcat/logs/fw/fw.html
log4j.appender.generalAppender.MaxFileSize=100KB
log4j.appender.generalAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.generalAppender.MaxBackupIndex=3

#email appender properties
log4j.appender.emailAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.emailAppender.File= //usr/local/tomcat/logs/fw/email.html
log4j.appender.emailAppender.MaxFileSize=300KB
log4j.appender.emailAppender.DatePattern='.'yyyy-MM-dd
log4j.appender.emailAppender.MaxBackupIndex=3

#general appender layout
log4j.appender.generalAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.generalAppender.layout.LocationInfo=true
log4j.appender.generalAppender.layout.Title=FW Application Log

#email appender layout
log4j.appender.emailAppender.layout=org.apache.log4j.HTMLLayout
log4j.appender.emailAppender.layout.LocationInfo=true
log4j.appender.emailAppender.layout.Title=FW Email Log

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]