logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reddy, Sanket \(US - Hyderabad\)" <sanre...@deloitte.com>
Subject RollingFileAppender is deleting backup files
Date Tue, 07 Nov 2006 13:27:29 GMT
Hi Guys

I am working on RollingFileAppender, with the following property file

log4j.rootLogger=INFO, stdout, logfile
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.appender.logfile = org.apache.log4j.RollingFileAppender
# Keep three backup files.
# Pattern to output: date priority [category] - message
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n

I am deploying a war file in weblogic 8.1 and the logging is done
properly, all the log files are created and updated according to the
RollingFileAppender requirements.

Now I am redeploying the same war file once again through the weblogic
console, but now the log files are deleted one at a time and finally
only one log file  (FileAppender.log)is left and same is being updated,
no backups are created. I tried N number of times and this is deletion
is repeating.

I am using 1.2.8 version and I can't change the version as vignette uses


-----Original Message-----
From: Blok, Eelke [mailto:eelke.blok@numico.com] 
Sent: Tuesday, November 07, 2006 2:11 PM
To: Log4J Users List
Subject: RE: How to configure 2 logger in the same configuration
property file


Hmm... I'm getting the feeling you don't fully understand what you're
doing (no offence). You are naming your loggers and your appenders to
something that looks a lot like logging levels, which at the very least
makes things confusing when, as a human, you're trying to understand
what is going on, but at worst might cause problems because the
configurator might understand what you mean to be a logger or an
appender as a log level, and vice versa. Also, by using only two
loggers, you are throwing away one of the biggest advantages of log4j,
which is granularity of logging statements, i.e., being able to "zoom
in" on a part of your program. My best advice to you is, stick with the
convention of naming loggers after the class they are used in. Have a
read through the short introduction to Log4J, it's really the foundation
you need when starting to use log4j.

The one problem I spot is that you're not specifying a filename for your
rolling file appender, which means anything you write to your MAIN
logger wouldn't be logged anywhere. Otherwise, purely syntactically, I
think your config is OK (but I'm relatively new to log4j as well, plus I
mainly use XML config files), but I think a line like this:
log4j.rootLogger=NORMAL, DEBUG
might actually cause trouble, because although you've defined both
NORMAL and DEBUG as appenders, DEBUG is also a logging level, which
could confuse the configurator. I would create loggers and appenders
with all different names (loggers preferably just named after the class
they're used in, you should distinguish the severity of a message by the
log level, not by using a different logger). So, no overlapping terms
for log levels, loggers and appenders, and see if you can get things to
work then. 

Best regards,

Eelke Blok

-----Original Message-----
From: ying lcs [mailto:yinglcs@gmail.com] 
Sent: dinsdag 7 november 2006 6:03
To: log4j-user@logging.apache.org
Subject: How to configure 2 logger in the same configuration property

I am new to log4j. Can you please tell me how can i configure 2 loggers
in the same properties file:

I have code like this, I only have 2 loggers in my whole application:

Logger normalCaseLogger = Logger.getLogger("NORMAL");
normalCaseLogger.info("normal case logging");

Logger debugLogger = Logger.getLogger("DEBUG");
debugLogger.info("debugging logging");

I have try my properties like this, but nothing get print out:

log4j.rootLogger=NORMAL, DEBUG

# Print the date in ISO 8601 format 
log4j.appender.NORMAL.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

# Print only messages of level WARN or above in the package com.foo.

log4j.appender.DEBUG =org.apache.log4j.ConsoleAppender 
log4j.logger.DEBUG = DEBUG

Thanks for any help.

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

PRIVACY: The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential and/or
priviliged material. Any review, retransmission, dissemination or other
use of this information by persons or entities other than the intended
recipient is prohibited. If you received this in error, please contact
the sender and delete the material from any computer. Thank you.

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org 

This message (including any attachments) contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
you should delete this message. 

Any disclosure, copying, or distribution of this message, or the taking of any action based
on it, is strictly prohibited. [v.E.1]

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message