Home

developers.mit.edu

Sort of helping developers at MIT since 2009

Secondary links

  • Forums
  • Recent Posts
Home Forums Java Developers
    • FAQ
    • Contact
    • Community

log4j properties

Submitted by sml@mit.edu on Thu, 01/29/2009 - 15:53
  • Java Developers
  • java log4j logging

I am not a Java guy, just a humble integrator trying to get a couple of canned java applications to run together in harmony.

I have two apps that say my log4j.properties file should be in common/classes and that my rootlogger be:

log4j.rootLogger=INFO, R

For one of these to sets of properties, can I change "R" to some other value, or is this explicit because the app that's logging will be looking for "R"?

Here's the whole bit:

# Default log4j.properties for SASH Server
#
log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.base}/logs/sash-server.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{ISO8601} [%t] %c - %m%n

# Settings for Hyperic monitoring agents
#log4j.rootLogger=INFO, R
#log4j.appender.R.File=/usr/local/hyperichq/server-4.0.2/hq-engine/server/default/log/tomcat.log
#log4j.appender.R.MaxBackupIndex=1
#log4j.appender.R.MaxFileSize=5000KB
#log4j.appender.R.layout.ConversionPattern=%d %-5p [%c{1}] %m%n
#log4j.appender.R.layout=org.apache.log4j.PatternLayout
#log4j.appender.R=org.apache.log4j.RollingFileAppender

‹ Errors parsing taglibs-standard-1.1.2-3.jar
  • Login to post comments

The significance of the "R"

Submitted by alister@mit.edu on Thu, 01/29/2009 - 16:49.

The significance of the "R" is that it is the name of the appender. With the log4j.rootLogger property, you specify a logging level (INFO in your case), and a list of appenders. The appender is configured later on in your log4j.properties file with all of the lines that say "log4j.appender.R ..."

You could change all the "R" to "Steve" and it would still work. But the fact that you have two separate apps with the same appender named "R" should in no way be a problem. In fact, in IDD, all our apps have an appender name "F1", they are are just configured to go to different files. So, probably, you have no need to change anything, just if you want the logging to show up in different files, make the "log4j.appender.R.File" property different. Is there some other reason you'd want to change the appender name?

  • Login to post comments

because knowing is half the battle

Submitted by sml@mit.edu on Thu, 01/29/2009 - 18:01.

I figured that if the appenders had names that told me what the were for, the whole rig would be more self documenting. In this case, one set of log4j properties is for sashserver logging (maybe INFO, SASH) and the other is for the Hyperic performance monitor (maybe INFO, Hyperic).

I am dealing with canned applications here, not applications built here at MIT. So I can't change the apps. But you're saying that the java application doesn't have to know about the appender name. So all I'm doing is piping whatever any app sends to log4j to two different places? That's fine.

  • Login to post comments

Yep, the appender names don't

Submitted by alister@mit.edu on Fri, 01/30/2009 - 08:48.

Yep, the appender names don't really have much significance outside of the log4j.properties file itself.

  • Login to post comments

Login

Log in via Touchstone

Forums

  • All Forums
  • General Questions
  • Drupal Users
  • FileMaker Developers
  • Identity Management
  • Java Developers
  • Linux Users
  • Opportunities
  • PHP Developers
  • Python Users
  • UX Developers
  • Web Masters
  • Suggestions

Tags

accessibility ajax branch Javascript jQuery MIT Touchstone openssl question from an openssl noob release management Shibboleth silverstripe source control speed
more tags
RoopleTheme