You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Frank Apap <fs...@optonline.net> on 2006/07/10 19:55:41 UTC

properties file question

I'm trying to do something that I'm pretty sure is simple but I cant
seem to figure out exactly what I need in the properties file.
 
I want to have 2 appenders, a file and console.  I want all messages for
all classes to go to the console but only Info (and above - e.g.
everything bug debug) to go to the file, again for all classes.  My
properties file looks like:
 
 
log4j.rootLogger=debug, stdout
 
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %t %c - %m%n
 
log4j.appender.LogFile=org.apache.log4j.RollingFileAppender
log4j.appender.LogFile.File=c:/outlog.log
 
log4j.appender.LogFile.MaxFileSize=500KB
# Keep one backup file
log4j.appender.LogFile.MaxBackupIndex=1
 
 
log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
log4j.appender.LogFile.layout.ConversionPattern=[%d] %p %t %c - %m%n
 
# setup all top level package names
log4j.logger.agentthreads=info, LogFile
log4j.logger.dbutil=info, LogFile
log4j.logger.com=info, LogFile
 
 
When I do this what happens is that for the package names I list in my
last section I do NOT see debug messages in my stdout appender.
 
Any ideas are appreciated.
 
Frank
 
 

Re: properties file question

Posted by James Stauffer <st...@gmail.com>.
I would suggest verifying that you are setting the threshold
correctly.  The logger lines define what is sent to the appenders but
the threshold line determine what is printed so the appender threshold
takes preference.

On 7/10/06, Frank Apap <fs...@optonline.net> wrote:
> I changed log4j.rootLoger line to :
>
> Log4j.rootLogger=debug,stdout,LogFile
>
> Then added
>
> Log4j.appender.LogFile.Theshold=info
>
> Now what happens is the LogFile appender gets the debug messages (it
> seems like the rootLogger line takes precendent over the Threshold -- or
> I'm setting it wrong).
>
> Frank
>
>
> -----Original Message-----
> From: James Stauffer [mailto:stauffer.james@gmail.com]
> Sent: Monday, July 10, 2006 2:32 PM
> To: Log4J Users List
> Subject: Re: properties file question
>
> I use the XML format instead of the properties format so this might
> not be exact:
> log4j.rootLogger=debug, stdout, LogFile
> Delete the loggers for the top 3 packages (last 3 lines)
> Set a threshold of info on the LogFile appender.
>
> On 7/10/06, Frank Apap <fs...@optonline.net> wrote:
> > I'm trying to do something that I'm pretty sure is simple but I cant
> > seem to figure out exactly what I need in the properties file.
> >
> > I want to have 2 appenders, a file and console.  I want all messages
> for
> > all classes to go to the console but only Info (and above - e.g.
> > everything bug debug) to go to the file, again for all classes.  My
> > properties file looks like:
> >
> >
> > log4j.rootLogger=debug, stdout
> >
> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> >
> > # Pattern to output the caller's file name and line number.
> > log4j.appender.stdout.layout.ConversionPattern=[%d] %p %t %c - %m%n
> >
> > log4j.appender.LogFile=org.apache.log4j.RollingFileAppender
> > log4j.appender.LogFile.File=c:/outlog.log
> >
> > log4j.appender.LogFile.MaxFileSize=500KB
> > # Keep one backup file
> > log4j.appender.LogFile.MaxBackupIndex=1
> >
> >
> > log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
> > log4j.appender.LogFile.layout.ConversionPattern=[%d] %p %t %c - %m%n
> >
> > # setup all top level package names
> > log4j.logger.agentthreads=info, LogFile
> > log4j.logger.dbutil=info, LogFile
> > log4j.logger.com=info, LogFile
> >
> >
> > When I do this what happens is that for the package names I list in my
> > last section I do NOT see debug messages in my stdout appender.
> >
> > Any ideas are appreciated.
> >
> > Frank
> >
> >
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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


RE: properties file question

Posted by Frank Apap <fs...@optonline.net>.
I changed log4j.rootLoger line to :

Log4j.rootLogger=debug,stdout,LogFile

Then added

Log4j.appender.LogFile.Theshold=info

Now what happens is the LogFile appender gets the debug messages (it
seems like the rootLogger line takes precendent over the Threshold -- or
I'm setting it wrong).

Frank


-----Original Message-----
From: James Stauffer [mailto:stauffer.james@gmail.com] 
Sent: Monday, July 10, 2006 2:32 PM
To: Log4J Users List
Subject: Re: properties file question

I use the XML format instead of the properties format so this might
not be exact:
log4j.rootLogger=debug, stdout, LogFile
Delete the loggers for the top 3 packages (last 3 lines)
Set a threshold of info on the LogFile appender.

On 7/10/06, Frank Apap <fs...@optonline.net> wrote:
> I'm trying to do something that I'm pretty sure is simple but I cant
> seem to figure out exactly what I need in the properties file.
>
> I want to have 2 appenders, a file and console.  I want all messages
for
> all classes to go to the console but only Info (and above - e.g.
> everything bug debug) to go to the file, again for all classes.  My
> properties file looks like:
>
>
> log4j.rootLogger=debug, stdout
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
> # Pattern to output the caller's file name and line number.
> log4j.appender.stdout.layout.ConversionPattern=[%d] %p %t %c - %m%n
>
> log4j.appender.LogFile=org.apache.log4j.RollingFileAppender
> log4j.appender.LogFile.File=c:/outlog.log
>
> log4j.appender.LogFile.MaxFileSize=500KB
> # Keep one backup file
> log4j.appender.LogFile.MaxBackupIndex=1
>
>
> log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.LogFile.layout.ConversionPattern=[%d] %p %t %c - %m%n
>
> # setup all top level package names
> log4j.logger.agentthreads=info, LogFile
> log4j.logger.dbutil=info, LogFile
> log4j.logger.com=info, LogFile
>
>
> When I do this what happens is that for the package names I list in my
> last section I do NOT see debug messages in my stdout appender.
>
> Any ideas are appreciated.
>
> Frank
>
>
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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


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


Re: properties file question

Posted by James Stauffer <st...@gmail.com>.
I use the XML format instead of the properties format so this might
not be exact:
log4j.rootLogger=debug, stdout, LogFile
Delete the loggers for the top 3 packages (last 3 lines)
Set a threshold of info on the LogFile appender.

On 7/10/06, Frank Apap <fs...@optonline.net> wrote:
> I'm trying to do something that I'm pretty sure is simple but I cant
> seem to figure out exactly what I need in the properties file.
>
> I want to have 2 appenders, a file and console.  I want all messages for
> all classes to go to the console but only Info (and above - e.g.
> everything bug debug) to go to the file, again for all classes.  My
> properties file looks like:
>
>
> log4j.rootLogger=debug, stdout
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
> # Pattern to output the caller's file name and line number.
> log4j.appender.stdout.layout.ConversionPattern=[%d] %p %t %c - %m%n
>
> log4j.appender.LogFile=org.apache.log4j.RollingFileAppender
> log4j.appender.LogFile.File=c:/outlog.log
>
> log4j.appender.LogFile.MaxFileSize=500KB
> # Keep one backup file
> log4j.appender.LogFile.MaxBackupIndex=1
>
>
> log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.LogFile.layout.ConversionPattern=[%d] %p %t %c - %m%n
>
> # setup all top level package names
> log4j.logger.agentthreads=info, LogFile
> log4j.logger.dbutil=info, LogFile
> log4j.logger.com=info, LogFile
>
>
> When I do this what happens is that for the package names I list in my
> last section I do NOT see debug messages in my stdout appender.
>
> Any ideas are appreciated.
>
> Frank
>
>
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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