You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Ambarish Mitra <am...@persistent.co.in> on 2005/02/21 14:07:49 UTC

Can I have time stamp in log file name?

Hi,

Can I have time stamp in log file name?

To elaborate, if my entries in the property files are:
...
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=../logs/example.log
..

Now, I want that instead of log file name: example.log, I want the name as
example.log.<time> of creation, is there any way to accomplish this?

-Ambarish.



RE: No appenders could be found for logger

Posted by Ambarish Mitra <am...@persistent.co.in>.
I withdraw the question. I have found the error. In the .so file, the
configure was not called correctly. My mistake, and sorry for this.

>  -----Original Message-----
> From: 	Ambarish Mitra [mailto:ambarish_mitra@persistent.co.in] 
> Sent:	Thursday, February 24, 2005 12:03 PM
> To:	log4cxx-user@logging.apache.org
> Subject:	No appenders could be found for logger
> 
> Hi,
> 
> I have written two separate and independent test programs to implement the
> log4cxx functionality, one is a stand-alone EXE and the other is a shared
> object (.so). The EXE is working correctly, and the shared object is
> outputting: 
> 
> No appenders could be found for logger (Test_so).
> Please initialize the log4cxx system properly.
> 
> 
> Both of these are using the *same* properties file. I have written another
> small EXE that just calls the function exposed by the shared object,
> that's all. [the shared object has the logging mechanism of log4cxx]
> 
> The snippet of the properties file is given below. Please advise if I am
> missing something. {OS: Solaris 8; compiler: gcc 3.3.2}
> 
> 
> log4j.rootLogger=debug, stdout, R
> 
> 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.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=../logs/example.log
> 
> log4j.appender.R.MaxFileSize=100KB
> 
> # Keep one backup file
> log4j.appender.R.MaxBackupIndex=1
> 
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
> 
> Regards,
> Ambarish.
> 
> 

No appenders could be found for logger

Posted by Ambarish Mitra <am...@persistent.co.in>.
Hi,

I have written two separate and independent test programs to implement the
log4cxx functionality, one is a stand-alone EXE and the other is a shared
object (.so). The EXE is working correctly, and the shared object is
outputting: 

No appenders could be found for logger (Test_so).
Please initialize the log4cxx system properly.


Both of these are using the *same* properties file. I have written another
small EXE that just calls the function exposed by the shared object, that's
all. [the shared object has the logging mechanism of log4cxx]

The snippet of the properties file is given below. Please advise if I am
missing something. {OS: Solaris 8; compiler: gcc 3.3.2}


log4j.rootLogger=debug, stdout, R

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.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=../logs/example.log

log4j.appender.R.MaxFileSize=100KB

# Keep one backup file
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

Regards,
Ambarish.



Re: Can I have time stamp in log file name?

Posted by Fa...@nucorsteel.com.
AFAICT, the closest to what you are looking for would be the 
DailyRolingFileAppender - it automatically renames old example.log to 
example.log.date format at midnight, when the new day file is created.

But, then there are few (significant) catches - there is no option to 
automatically delete old files (really a pain). Also, it has been 
deprecated in log4j (in favor of using strategy design pattern, I 
believe), so I guess it will go away in log4cxx as well.

Alex

"Ambarish Mitra" <am...@persistent.co.in> wrote on 02/21/2005 
08:07:49 AM:

> Hi,
> 
> Can I have time stamp in log file name?
> 
> To elaborate, if my entries in the property files are:
> ...
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=../logs/example.log
> ..
> 
> Now, I want that instead of log file name: example.log, I want the name 
as
> example.log.<time> of creation, is there any way to accomplish this?
> 
> -Ambarish.
> 
> 
> [attachment "winmail.dat" deleted by Aleksandar 
Fabijanic/Maintenance/NSB]