Logging to different files with log4j 2

2014-03-19 Thread Heribert Hansen
I have an application that should write logging information into different
files. The application executes several tasks (partially in parallel).
Every task should use a separate file for logging. The filename should be
{loggingBasePath}/{taskId}.log. The loggingBasePath will be configurable
by a command line argument. The taskId is the id of the task the
application executes and will be assigned at runtime to the task after
instantiation of the task. As you can see, the filename of the log is very
dynamic and is not defined at startup.

The other parts of the application should write log entries to another log
file called application.log.

Is that possible with log4j 2?

Thank you very much!


Re: Logging to different files with log4j 2

2014-03-19 Thread Ralph Goers
Yes, this is possible with the RoutingAppender.

Ralph

 On Mar 18, 2014, at 11:47 PM, Heribert Hansen 
 heribert.han...@googlemail.com wrote:
 
 I have an application that should write logging information into different
 files. The application executes several tasks (partially in parallel).
 Every task should use a separate file for logging. The filename should be
 {loggingBasePath}/{taskId}.log. The loggingBasePath will be configurable
 by a command line argument. The taskId is the id of the task the
 application executes and will be assigned at runtime to the task after
 instantiation of the task. As you can see, the filename of the log is very
 dynamic and is not defined at startup.
 
 The other parts of the application should write log entries to another log
 file called application.log.
 
 Is that possible with log4j 2?
 
 Thank you very much!

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



logging to different files depending on class

2006-12-18 Thread Tim B
I would like to send my logging output to different log files from 3
different java classes, all in the same package. Would someone please point
me to where I can find info/examples of how to do this?

Thanks,
TimB




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: logging to different files depending on class

2006-12-18 Thread Blok, Eelke
Hi Tim,

If you log to loggers that are named after the classes you're logging
from (which is the most common convention for naming loggers), you can
simply use three different file appenders that you attach to the loggers
corresponding to your classes. This is basic log4j, have a read through
http://logging.apache.org/log4j/docs/manual.html (short introduction to
log4j) if you don't understand what I mean.

Good luck,

Eelke

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Tim B
Sent: dinsdag 19 december 2006 3:14
To: log4j-user@logging.apache.org
Subject: logging to different files depending on class


I would like to send my logging output to different log files from 3
different java classes, all in the same package. Would someone please
point me to where I can find info/examples of how to do this?

Thanks,
TimB




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Logging into different files depending on the log client's host

2006-12-07 Thread Bence Takács

Hello

The documentation of SocketServer says that I can set different log
configurations for different log clients.
(
http://logging.apache.org/log4j/docs/api/org/apache/log4j/net/SocketServer.html)

I made different config files for the log clients, restart the server and
then get the following exception:

Connected to client at /172.16.200.13
Locating configuration file for /172.16.200.13
Could not find config file [/mnt/log/.lcf].
Could not find config file [/mnt/log/generic.lcf]. Will use the default
hierarchy.

But I _have_ a config file called 172.16.200.13.lcf in the log directory. I
tried this with [hostname].lcf too, but get the same result.

Any tips?

Thanks:
  Bence


logging into different files

2006-10-11 Thread sudhakardvvn

Have an application where the number of threads that get launched are
dynamic.  Could be anywhere from 1 to 300 threads that could get launched at
runtime.  I would like to know if it is possible to setup a file appender
for each thread and have the indiv threads write to their own file appender. 
Currently all threads write to one log file using 1 file appender in a
log4j.properties file but would like ability for each thread to log its own
messages for easier debugging. Any good sites or source would be great. Any
help would be appreciated.  

-- 
View this message in context: 
http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



logging into different files

2006-10-11 Thread Bender Heri
This was discussed a lot on this list. Search in archive, keywords: MDC, 
RepositorySelector, different files.

We currently discuss on the developper list the introduction of a 
MultiFileAppender which addresses just your need. But the work is still in 
progress...

Heri

 -Original Message-
 From: sudhakardvvn [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 11, 2006 1:49 PM
 To: log4j-user@logging.apache.org
 Subject: [SPAM (Bayesain Analysis)] - logging into different files -
 Bayesian Filter detected spam
 
 
 
 Have an application where the number of threads that get launched are
 dynamic.  Could be anywhere from 1 to 300 threads that could 
 get launched at
 runtime.  I would like to know if it is possible to setup a 
 file appender
 for each thread and have the indiv threads write to their own 
 file appender. 
 Currently all threads write to one log file using 1 file appender in a
 log4j.properties file but would like ability for each thread 
 to log its own
 messages for easier debugging. Any good sites or source would 
 be great. Any
 help would be appreciated.  
 
 -- 
 View this message in context: 
 http://www.nabble.com/logging-into-different-files-tf2422885.h
 tml#a6754850
 Sent from the Log4j - Users mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logging into different files

2006-10-11 Thread James Stauffer

That should be possible by writing your own appender.  Search the
archives as this was discussed recently.

On 10/11/06, sudhakardvvn [EMAIL PROTECTED] wrote:


Have an application where the number of threads that get launched are
dynamic.  Could be anywhere from 1 to 300 threads that could get launched at
runtime.  I would like to know if it is possible to setup a file appender
for each thread and have the indiv threads write to their own file appender.
Currently all threads write to one log file using 1 file appender in a
log4j.properties file but would like ability for each thread to log its own
messages for easier debugging. Any good sites or source would be great. Any
help would be appreciated.

--
View this message in context: 
http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: logging into different files

2006-10-11 Thread Michael Giroux

I think that you could use something like:

PatternLayout pattern = new PatternLayout(your pattern);
String filename = some file name based on thread name;
FileAppender  threadAppender = new FileAppender(pattern, filename);
String threadLogName = some log name derived from thread name;
Logger threadLog = Logger.getLogger(threadLogName);
threadLog.setAdditivity(false);
threadLog.addAppender(threadLog);

Michael Giroux

On 10/11/06, sudhakardvvn [EMAIL PROTECTED] wrote:


Have an application where the number of threads that get launched are
dynamic.  Could be anywhere from 1 to 300 threads that could get launched at
runtime.  I would like to know if it is possible to setup a file appender
for each thread and have the indiv threads write to their own file appender.
Currently all threads write to one log file using 1 file appender in a
log4j.properties file but would like ability for each thread to log its own
messages for easier debugging. Any good sites or source would be great. Any
help would be appreciated.

--
View this message in context: 
http://www.nabble.com/logging-into-different-files-tf2422885.html#a6754850
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Logging to different files depending on level using a single user and properties file

2006-04-27 Thread James Stauffer
http://logging.apache.org/log4j/docs/api/org/apache/log4j/varia/LevelRangeFilter.html

BTW, Google is your friend.  That was the 2nd link when I searched for
log4j level range

On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 I have no idea how to set the range.Can you help me with this?



 On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
 
  There is a way to set a range of levels.  Look through the API.  That
  might only be an option when using an XML config file.
 
  On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
   Hey,
 After i removed semi colon only ERROR messages are sent to error.logbut
   still stat.log is getting all the messages equal to and greater than
   INFO,since i have set the threshold=INFO for S.
   What can be done to direct only INFO messages to stats.log?
  
   On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
   
Then it appears that the threshold isn't set correctly.  I use the XML
config format so I am not familiar with the properties format, but I
would double-check how you are setting the threshold.  One thing that
does look suspect is the semi-colon on the end of the threshold line.
   
On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 Whatever level i specify at the rootlogger, all those log messages
  are
 logged to both the files.
 say,
 Log4j.rootLogger=INFO,E,S

 All the log messages equal to and above are logged to error.log and
stat.log


 On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
 
  Does error.log get debug, info, or warn messages?
 
  On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
   Hi,
Thanks for the reply.I want to direct messages to different
  files
  depending
   on level.say, ERROR messages to error.log , INFO messages to
stats.log .
  But
   I am getting all the messages in all the files.
  Is there any other way i can do this in a properties file?
  
  
   On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
   
stdout should get all logs.  E should only get ERROR and FATAL
logs.
S should get everything from INFO to FATAL.  Is that different
than
what you see?
   
On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 Hi,

Do you have ant idea how to log messages to different
  files
  depending
on
 levels using a single logger? in a properties file?

 here is my properties file :


 log4j.rootLogger=DEBUG,stdout,E,S

 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=%5p [%t]
  (%F:%L)
-
  %m%n

  #log4j.logger.appender.E.access = ERROR

 log4j.appender.E=org.apache.log4j.RollingFileAppender

 log4j.appender.E.File=error.log

 log4j.appender.E.MaxFileSize=100KB

 log4j.appender.E.MaxBackupIndex=1

 log4j.appender.E.layout=org.apache.log4j.PatternLayout

 log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n

 log4j.appender.E.Threshold=ERROR;

 log4j.appender.S=org.apache.log4j.RollingFileAppender

 log4j.appender.S.File=stats.log

 log4j.appender.S.MaxFileSize=100KB

 # Keep one backup file

 log4j.appender.S.MaxBackupIndex=1

 log4j.appender.S.layout=org.apache.log4j.PatternLayout

 log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n

 log4j.appender.S.Threshold=INFO;

 but this is not working.


   
   
--
James Stauffer
Are you good? Take the test at
  http://www.livingwaters.com/good/
   
   
-
To unsubscribe, e-mail:
  [EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
   
   
  
  
 
 
  --
  James Stauffer
  Are you good? Take the test at http://www.livingwaters.com/good/
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 
 


   
   
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
  
 
 
  --
  James Stauffer
  Are you good? Take the test at 

Logging to different files depending on level using a single user and properties file

2006-04-26 Thread Nageena Parveen
Hi,

   Do you have ant idea how to log messages to different files depending on
levels using a single logger? in a properties file?

here is my properties file :


log4j.rootLogger=DEBUG,stdout,E,S

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=%5p [%t] (%F:%L) - %m%n

 #log4j.logger.appender.E.access = ERROR

log4j.appender.E=org.apache.log4j.RollingFileAppender

log4j.appender.E.File=error.log

log4j.appender.E.MaxFileSize=100KB

log4j.appender.E.MaxBackupIndex=1

log4j.appender.E.layout=org.apache.log4j.PatternLayout

log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n

log4j.appender.E.Threshold=ERROR;

log4j.appender.S=org.apache.log4j.RollingFileAppender

log4j.appender.S.File=stats.log

log4j.appender.S.MaxFileSize=100KB

# Keep one backup file

log4j.appender.S.MaxBackupIndex=1

log4j.appender.S.layout=org.apache.log4j.PatternLayout

log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n

log4j.appender.S.Threshold=INFO;

but this is not working.


Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread James Stauffer
stdout should get all logs.  E should only get ERROR and FATAL logs. 
S should get everything from INFO to FATAL.  Is that different than
what you see?

On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 Hi,

Do you have ant idea how to log messages to different files depending on
 levels using a single logger? in a properties file?

 here is my properties file :


 log4j.rootLogger=DEBUG,stdout,E,S

 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=%5p [%t] (%F:%L) - %m%n

  #log4j.logger.appender.E.access = ERROR

 log4j.appender.E=org.apache.log4j.RollingFileAppender

 log4j.appender.E.File=error.log

 log4j.appender.E.MaxFileSize=100KB

 log4j.appender.E.MaxBackupIndex=1

 log4j.appender.E.layout=org.apache.log4j.PatternLayout

 log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n

 log4j.appender.E.Threshold=ERROR;

 log4j.appender.S=org.apache.log4j.RollingFileAppender

 log4j.appender.S.File=stats.log

 log4j.appender.S.MaxFileSize=100KB

 # Keep one backup file

 log4j.appender.S.MaxBackupIndex=1

 log4j.appender.S.layout=org.apache.log4j.PatternLayout

 log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n

 log4j.appender.S.Threshold=INFO;

 but this is not working.




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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread Nageena Parveen
Hi,
 Thanks for the reply.I want to direct messages to different files depending
on level.say, ERROR messages to error.log , INFO messages to stats.log . But
I am getting all the messages in all the files.
   Is there any other way i can do this in a properties file?


On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:

 stdout should get all logs.  E should only get ERROR and FATAL logs.
 S should get everything from INFO to FATAL.  Is that different than
 what you see?

 On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
  Hi,
 
 Do you have ant idea how to log messages to different files depending
 on
  levels using a single logger? in a properties file?
 
  here is my properties file :
 
 
  log4j.rootLogger=DEBUG,stdout,E,S
 
  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=%5p [%t] (%F:%L) - %m%n
 
   #log4j.logger.appender.E.access = ERROR
 
  log4j.appender.E=org.apache.log4j.RollingFileAppender
 
  log4j.appender.E.File=error.log
 
  log4j.appender.E.MaxFileSize=100KB
 
  log4j.appender.E.MaxBackupIndex=1
 
  log4j.appender.E.layout=org.apache.log4j.PatternLayout
 
  log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n
 
  log4j.appender.E.Threshold=ERROR;
 
  log4j.appender.S=org.apache.log4j.RollingFileAppender
 
  log4j.appender.S.File=stats.log
 
  log4j.appender.S.MaxFileSize=100KB
 
  # Keep one backup file
 
  log4j.appender.S.MaxBackupIndex=1
 
  log4j.appender.S.layout=org.apache.log4j.PatternLayout
 
  log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
 
  log4j.appender.S.Threshold=INFO;
 
  but this is not working.
 
 


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

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread James Stauffer
Does error.log get debug, info, or warn messages?

On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 Hi,
  Thanks for the reply.I want to direct messages to different files depending
 on level.say, ERROR messages to error.log , INFO messages to stats.log . But
 I am getting all the messages in all the files.
Is there any other way i can do this in a properties file?


 On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
 
  stdout should get all logs.  E should only get ERROR and FATAL logs.
  S should get everything from INFO to FATAL.  Is that different than
  what you see?
 
  On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
   Hi,
  
  Do you have ant idea how to log messages to different files depending
  on
   levels using a single logger? in a properties file?
  
   here is my properties file :
  
  
   log4j.rootLogger=DEBUG,stdout,E,S
  
   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=%5p [%t] (%F:%L) - %m%n
  
#log4j.logger.appender.E.access = ERROR
  
   log4j.appender.E=org.apache.log4j.RollingFileAppender
  
   log4j.appender.E.File=error.log
  
   log4j.appender.E.MaxFileSize=100KB
  
   log4j.appender.E.MaxBackupIndex=1
  
   log4j.appender.E.layout=org.apache.log4j.PatternLayout
  
   log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n
  
   log4j.appender.E.Threshold=ERROR;
  
   log4j.appender.S=org.apache.log4j.RollingFileAppender
  
   log4j.appender.S.File=stats.log
  
   log4j.appender.S.MaxFileSize=100KB
  
   # Keep one backup file
  
   log4j.appender.S.MaxBackupIndex=1
  
   log4j.appender.S.layout=org.apache.log4j.PatternLayout
  
   log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
  
   log4j.appender.S.Threshold=INFO;
  
   but this is not working.
  
  
 
 
  --
  James Stauffer
  Are you good? Take the test at http://www.livingwaters.com/good/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread Nageena Parveen
Whatever level i specify at the rootlogger, all those log messages are
logged to both the files.
say,
Log4j.rootLogger=INFO,E,S

All the log messages equal to and above are logged to error.log and stat.log


On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:

 Does error.log get debug, info, or warn messages?

 On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
  Hi,
   Thanks for the reply.I want to direct messages to different files
 depending
  on level.say, ERROR messages to error.log , INFO messages to stats.log .
 But
  I am getting all the messages in all the files.
 Is there any other way i can do this in a properties file?
 
 
  On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
  
   stdout should get all logs.  E should only get ERROR and FATAL logs.
   S should get everything from INFO to FATAL.  Is that different than
   what you see?
  
   On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
Hi,
   
   Do you have ant idea how to log messages to different files
 depending
   on
levels using a single logger? in a properties file?
   
here is my properties file :
   
   
log4j.rootLogger=DEBUG,stdout,E,S
   
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=%5p [%t] (%F:%L) -
 %m%n
   
 #log4j.logger.appender.E.access = ERROR
   
log4j.appender.E=org.apache.log4j.RollingFileAppender
   
log4j.appender.E.File=error.log
   
log4j.appender.E.MaxFileSize=100KB
   
log4j.appender.E.MaxBackupIndex=1
   
log4j.appender.E.layout=org.apache.log4j.PatternLayout
   
log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n
   
log4j.appender.E.Threshold=ERROR;
   
log4j.appender.S=org.apache.log4j.RollingFileAppender
   
log4j.appender.S.File=stats.log
   
log4j.appender.S.MaxFileSize=100KB
   
# Keep one backup file
   
log4j.appender.S.MaxBackupIndex=1
   
log4j.appender.S.layout=org.apache.log4j.PatternLayout
   
log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
   
log4j.appender.S.Threshold=INFO;
   
but this is not working.
   
   
  
  
   --
   James Stauffer
   Are you good? Take the test at http://www.livingwaters.com/good/
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 


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

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread James Stauffer
Then it appears that the threshold isn't set correctly.  I use the XML
config format so I am not familiar with the properties format, but I
would double-check how you are setting the threshold.  One thing that
does look suspect is the semi-colon on the end of the threshold line.

On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 Whatever level i specify at the rootlogger, all those log messages are
 logged to both the files.
 say,
 Log4j.rootLogger=INFO,E,S

 All the log messages equal to and above are logged to error.log and stat.log


 On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
 
  Does error.log get debug, info, or warn messages?
 
  On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
   Hi,
Thanks for the reply.I want to direct messages to different files
  depending
   on level.say, ERROR messages to error.log , INFO messages to stats.log .
  But
   I am getting all the messages in all the files.
  Is there any other way i can do this in a properties file?
  
  
   On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
   
stdout should get all logs.  E should only get ERROR and FATAL logs.
S should get everything from INFO to FATAL.  Is that different than
what you see?
   
On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
 Hi,

Do you have ant idea how to log messages to different files
  depending
on
 levels using a single logger? in a properties file?

 here is my properties file :


 log4j.rootLogger=DEBUG,stdout,E,S

 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=%5p [%t] (%F:%L) -
  %m%n

  #log4j.logger.appender.E.access = ERROR

 log4j.appender.E=org.apache.log4j.RollingFileAppender

 log4j.appender.E.File=error.log

 log4j.appender.E.MaxFileSize=100KB

 log4j.appender.E.MaxBackupIndex=1

 log4j.appender.E.layout=org.apache.log4j.PatternLayout

 log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n

 log4j.appender.E.Threshold=ERROR;

 log4j.appender.S=org.apache.log4j.RollingFileAppender

 log4j.appender.S.File=stats.log

 log4j.appender.S.MaxFileSize=100KB

 # Keep one backup file

 log4j.appender.S.MaxBackupIndex=1

 log4j.appender.S.layout=org.apache.log4j.PatternLayout

 log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n

 log4j.appender.S.Threshold=INFO;

 but this is not working.


   
   
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
  
 
 
  --
  James Stauffer
  Are you good? Take the test at http://www.livingwaters.com/good/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




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

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread Nageena Parveen
Hey,
  After i removed semi colon only ERROR messages are sent to error.log but
still stat.log is getting all the messages equal to and greater than
INFO,since i have set the threshold=INFO for S.
What can be done to direct only INFO messages to stats.log?

On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:

 Then it appears that the threshold isn't set correctly.  I use the XML
 config format so I am not familiar with the properties format, but I
 would double-check how you are setting the threshold.  One thing that
 does look suspect is the semi-colon on the end of the threshold line.

 On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
  Whatever level i specify at the rootlogger, all those log messages are
  logged to both the files.
  say,
  Log4j.rootLogger=INFO,E,S
 
  All the log messages equal to and above are logged to error.log and
 stat.log
 
 
  On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
  
   Does error.log get debug, info, or warn messages?
  
   On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
Hi,
 Thanks for the reply.I want to direct messages to different files
   depending
on level.say, ERROR messages to error.log , INFO messages to
 stats.log .
   But
I am getting all the messages in all the files.
   Is there any other way i can do this in a properties file?
   
   
On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:

 stdout should get all logs.  E should only get ERROR and FATAL
 logs.
 S should get everything from INFO to FATAL.  Is that different
 than
 what you see?

 On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
  Hi,
 
 Do you have ant idea how to log messages to different files
   depending
 on
  levels using a single logger? in a properties file?
 
  here is my properties file :
 
 
  log4j.rootLogger=DEBUG,stdout,E,S
 
  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=%5p [%t] (%F:%L)
 -
   %m%n
 
   #log4j.logger.appender.E.access = ERROR
 
  log4j.appender.E=org.apache.log4j.RollingFileAppender
 
  log4j.appender.E.File=error.log
 
  log4j.appender.E.MaxFileSize=100KB
 
  log4j.appender.E.MaxBackupIndex=1
 
  log4j.appender.E.layout=org.apache.log4j.PatternLayout
 
  log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n
 
  log4j.appender.E.Threshold=ERROR;
 
  log4j.appender.S=org.apache.log4j.RollingFileAppender
 
  log4j.appender.S.File=stats.log
 
  log4j.appender.S.MaxFileSize=100KB
 
  # Keep one backup file
 
  log4j.appender.S.MaxBackupIndex=1
 
  log4j.appender.S.layout=org.apache.log4j.PatternLayout
 
  log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
 
  log4j.appender.S.Threshold=INFO;
 
  but this is not working.
 
 


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


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]


   
   
  
  
   --
   James Stauffer
   Are you good? Take the test at http://www.livingwaters.com/good/
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 


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

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Logging to different files depending on level using a single user and properties file

2006-04-26 Thread Nageena Parveen
I have no idea how to set the range.Can you help me with this?



On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:

 There is a way to set a range of levels.  Look through the API.  That
 might only be an option when using an XML config file.

 On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
  Hey,
After i removed semi colon only ERROR messages are sent to error.logbut
  still stat.log is getting all the messages equal to and greater than
  INFO,since i have set the threshold=INFO for S.
  What can be done to direct only INFO messages to stats.log?
 
  On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
  
   Then it appears that the threshold isn't set correctly.  I use the XML
   config format so I am not familiar with the properties format, but I
   would double-check how you are setting the threshold.  One thing that
   does look suspect is the semi-colon on the end of the threshold line.
  
   On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
Whatever level i specify at the rootlogger, all those log messages
 are
logged to both the files.
say,
Log4j.rootLogger=INFO,E,S
   
All the log messages equal to and above are logged to error.log and
   stat.log
   
   
On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:

 Does error.log get debug, info, or warn messages?

 On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
  Hi,
   Thanks for the reply.I want to direct messages to different
 files
 depending
  on level.say, ERROR messages to error.log , INFO messages to
   stats.log .
 But
  I am getting all the messages in all the files.
 Is there any other way i can do this in a properties file?
 
 
  On 4/27/06, James Stauffer [EMAIL PROTECTED] wrote:
  
   stdout should get all logs.  E should only get ERROR and FATAL
   logs.
   S should get everything from INFO to FATAL.  Is that different
   than
   what you see?
  
   On 4/26/06, Nageena Parveen [EMAIL PROTECTED] wrote:
Hi,
   
   Do you have ant idea how to log messages to different
 files
 depending
   on
levels using a single logger? in a properties file?
   
here is my properties file :
   
   
log4j.rootLogger=DEBUG,stdout,E,S
   
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=%5p [%t]
 (%F:%L)
   -
 %m%n
   
 #log4j.logger.appender.E.access = ERROR
   
log4j.appender.E=org.apache.log4j.RollingFileAppender
   
log4j.appender.E.File=error.log
   
log4j.appender.E.MaxFileSize=100KB
   
log4j.appender.E.MaxBackupIndex=1
   
log4j.appender.E.layout=org.apache.log4j.PatternLayout
   
log4j.appender.E.layout.ConversionPattern=%p %t %c - %m%n
   
log4j.appender.E.Threshold=ERROR;
   
log4j.appender.S=org.apache.log4j.RollingFileAppender
   
log4j.appender.S.File=stats.log
   
log4j.appender.S.MaxFileSize=100KB
   
# Keep one backup file
   
log4j.appender.S.MaxBackupIndex=1
   
log4j.appender.S.layout=org.apache.log4j.PatternLayout
   
log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
   
log4j.appender.S.Threshold=INFO;
   
but this is not working.
   
   
  
  
   --
   James Stauffer
   Are you good? Take the test at
 http://www.livingwaters.com/good/
  
  
   -
   To unsubscribe, e-mail:
 [EMAIL PROTECTED]
   For additional commands, e-mail:
   [EMAIL PROTECTED]
  
  
 
 


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


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]


   
   
  
  
   --
   James Stauffer
   Are you good? Take the test at http://www.livingwaters.com/good/
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 


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

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: logging to different files

2005-03-03 Thread ron
What I would like to do is:
Log net.tutim on DEBUG level *only* to one log,
Log all others on INFO level *only* to another log,
Can anyone help me with that?

Curt Arnold:
On Mar 2, 2005, at 3:32 PM, ron wrote:
Hi,
I am trying to set log4j under tomcat to log certain java packages 
to  certain logs. My properties file is:
--- 
--

...
--- 
-
I would want all the net.tutim.* classes to log to T.
but they log to R.
Can someone help me with that?

Cheers,
Ron

From my quick reading, it looks like INFO and higher logging requests  
would go to both R and T (maybe twice) and DEBUG messages would only 
go  to T.  Unless you specify additivity=false for a logger, the 
message is  also processed by appenders attached lower in the 
hierarchy.  If this  isn't what you are seeing, ignore this message.

If my analysis does describe what you are seeing, read  
http://logging.apache.org/log4j/docs/manual.html and search for  
Appender additivity and add a:

log4j.additivity.net.tutim=false
to your config file.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: logging to different files

2005-03-03 Thread Jacob Kjome
Quoting ron [EMAIL PROTECTED]:

 What I would like to do is:
 Log net.tutim on DEBUG level *only* to one log,
 Log all others on INFO level *only* to another log,

 Can anyone help me with that?


You don't have your config in this email, but as I recall from yesterday, you
had both appenders attached to the root logger.  If you don't want any other
messages than those coming from net.tutim going to that appender, remove it
from the root logger and add it only to the net.tutim logger.  And then do as
was suggested by both Curt and myself, which was using additivity on the
net.tutim logger

log4j.additivity.net.tutim=false


Jake



 Curt Arnold:

 
  On Mar 2, 2005, at 3:32 PM, ron wrote:
 
  Hi,
  I am trying to set log4j under tomcat to log certain java packages
  to  certain logs. My properties file is:
  ---
  --
 
  ...
 
  ---
  -
  I would want all the net.tutim.* classes to log to T.
  but they log to R.
  Can someone help me with that?
 
  Cheers,
  Ron
 
 
 
  From my quick reading, it looks like INFO and higher logging requests
  would go to both R and T (maybe twice) and DEBUG messages would only
  go  to T.  Unless you specify additivity=false for a logger, the
  message is  also processed by appenders attached lower in the
  hierarchy.  If this  isn't what you are seeing, ignore this message.
 
  If my analysis does describe what you are seeing, read
  http://logging.apache.org/log4j/docs/manual.html and search for
  Appender additivity and add a:
 
  log4j.additivity.net.tutim=false
 
  to your config file.
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



logging to different files

2005-03-02 Thread ron
Hi,
I am trying to set log4j under tomcat to log certain java packages to 
certain logs. My properties file is:
-
log4j.rootLogger=info, R, T
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
log4j.logger.org.apache.catalina=INFO, R

log4j.appender.T=org.apache.log4j.RollingFileAppender
log4j.appender.T.File=${catalina.home}/logs/xtap.log
log4j.appender.T.MaxFileSize=10MB
log4j.appender.T.MaxBackupIndex=10
log4j.appender.T.layout=org.apache.log4j.PatternLayout
log4j.appender.T.layout.ConversionPattern=%p %t %c - %m%n
log4j.logger.net.tutim=DEBUG, T

I would want all the net.tutim.* classes to log to T.
but they log to R.
Can someone help me with that?
Cheers,
Ron
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: logging to different files

2005-03-02 Thread Curt Arnold
On Mar 2, 2005, at 3:32 PM, ron wrote:
Hi,
I am trying to set log4j under tomcat to log certain java packages to  
certain logs. My properties file is:
--- 
--

...
--- 
-
I would want all the net.tutim.* classes to log to T.
but they log to R.
Can someone help me with that?

Cheers,
Ron

From my quick reading, it looks like INFO and higher logging requests  
would go to both R and T (maybe twice) and DEBUG messages would only go  
to T.  Unless you specify additivity=false for a logger, the message is  
also processed by appenders attached lower in the hierarchy.  If this  
isn't what you are seeing, ignore this message.

If my analysis does describe what you are seeing, read  
http://logging.apache.org/log4j/docs/manual.html and search for  
Appender additivity and add a:

log4j.additivity.net.tutim=false
to your config file.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: logging to different files

2005-03-02 Thread ron
 Curt Arnold:
On Mar 2, 2005, at 3:32 PM, ron wrote:
Hi,
I am trying to set log4j under tomcat to log certain java packages to 
certain logs. My properties file is:
--- 
--

...
--- 
-
I would want all the net.tutim.* classes to log to T.
but they log to R.
Can someone help me with that?

Cheers,
Ron

From my quick reading, it looks like INFO and higher logging requests 
would go to both R and T (maybe twice) and DEBUG messages would only 
go to T.
But this does not happen. I have 3 INFO messages on R, and none on T.
Furhter, I have other INFO messages in T, so it works fine, but messages 
from net.tutim go to R :(

Unless you specify additivity=false for a logger, the message is also 
processed by appenders attached lower in the hierarchy. If this isn't 
what you are seeing, ignore this message.
I will try the additive property tommorow :)
If my analysis does describe what you are seeing, read 
http://logging.apache.org/log4j/docs/manual.html and search for 
Appender additivity and add a:

log4j.additivity.net.tutim=false
to your config file.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


different classes logging to different files

2004-06-28 Thread Markus Mayer
hi all,
so far log4j worked really great for me. thanks for everything. but now i 
am facing a (probably) minor problem that i couldn't fix for some time. 

i would like to have a general log file for all my classes in my 
application. under special circumstances i would like to send some log 
messages to two log files (one only containing the special messages). i 
set up log4j like this

# *
# ** Logger configuration** 
# *
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=INFO, stdout, logfile
log4j.TaskLogger=INFO, stdout, logfile
log4j.FailureLogger=INFO, stdout,failurefile

# stdout is set to be a ConsoleAppender.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender

# stdout uses PatternLayout.
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-5r (%d) [%t] %-5p %c %x - 
%m%n
 
#logfile
log4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.Append=false
log4j.appender.logfile.File=migration.log
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%-5r (%d) [%t] %-5p %c %x 
- %m%n

#failurefile
log4j.appender.failurefile=org.apache.log4j.FileAppender
log4j.appender.failurefile.Append=false
log4j.appender.failurefile.File=failure.log
log4j.appender.failurefile.layout=org.apache.log4j.PatternLayout
log4j.appender.failurefile.layout.ConversionPattern=%-5r (%d) [%t] %-5p %c 
%x - %m%n

in java i setup the loggers like this:

snip
Logger logger = Logger.getLogger(log4j.TaskLogger);
Logger migFailedLogger = Logger.getLogger(log4j.FailureLogger);
PropertyConfigurator.configure(props);
/snip

when i send an event to the second (migFailedLogger) i only get entries in 
the appenders stdout and in logfile but not in the failurefile 
appender. anybody knows what's going wrong here?

thanks in advance,
markus