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 Abhay <ab...@math.net> on 2005/11/10 18:32:16 UTC
Logging in Multiple files
Hi ,
I want to log in multiple files.
Can you please tell me how to do it.
I am using log4j.properties file, it is as shown below
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.stdout.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/logs/sco.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
Many thanks in advance
Abhay
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Logging in Multiple files
Posted by James Stauffer <st...@gmail.com>.
Just define another file appender and include it in log4j.rootLogger.
On 11/10/05, Abhay <ab...@math.net> wrote:
> Hi ,
>
> I want to log in multiple files.
>
> Can you please tell me how to do it.
>
> I am using log4j.properties file, it is as shown below
>
> 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.stdout.layout.ConversionPattern=%p %t %c - %m%n
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=/logs/sco.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
>
> Many thanks in advance
> Abhay
>
>
> ---------------------------------------------------------------------
> 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: Logging in Multiple files
Posted by Abhay <ab...@math.net>.
How does the xml stuff work.
Can you help me understand with an example.
Where do you put ur log4j.xml file.
Do you need anything else to configure it.
Thanks and Regards
Abhay
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Logging in Multiple files
Posted by James Stauffer <st...@gmail.com>.
I use the xml format for my configuration so I am not exactly sure how
to do it with a properties file.
On 11/10/05, Abhay <ab...@math.net> wrote:
> Can you show me how to do it.
>
> For a particular module i need to write in one file and for other module i
> need to write in another file.
>
> It would be great if you could show me with an example.
>
>
>
>
> ---------------------------------------------------------------------
> 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: Logging in Multiple files
Posted by Abhay <ab...@math.net>.
Can you show me how to do it.
For a particular module i need to write in one file and for other module i
need to write in another file.
It would be great if you could show me with an example.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Logging failing because the intermediate directories do not exist
Posted by Curt Arnold <ca...@apache.org>.
See bug http://issues.apache.org/bugzilla/show_bug.cgi?id=9150.
FileAppenders in 1.2.12 and the current SVN HEAD both attempt to
create directories if the parent directory does not exist.
If you'd like to report a bug, please be more specific about what is
occurring and the circumstances. The new code in the FileAppender
will create directories with the default permissions inherited from
the last available parent directory. It may be possible for the
directories to be created, but to still lack the access rights to
create files in the directories.
On Nov 17, 2005, at 10:04 AM, James Stauffer wrote:
> I have never seen a case where a log4j appender creates a directory.
> Under what circumstances does it create directories?
>
> On 11/17/05, Vin Karthik <vi...@yahoo.com> wrote:
>> There are cases when the appender creates directories and drops
>> the log files if the directories dont exist..It is happening with
>> log4j1.2.12..can you please help me?
>
> --
> 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: Logging failing because the intermediate directories do not exist
Posted by James Stauffer <st...@gmail.com>.
I have never seen a case where a log4j appender creates a directory.
Under what circumstances does it create directories?
On 11/17/05, Vin Karthik <vi...@yahoo.com> wrote:
> There are cases when the appender creates directories and drops the log files if the directories dont exist..It is happening with log4j1.2.12..can you please help me?
--
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: Logging failing because the intermediate directories do not exist
Posted by Vin Karthik <vi...@yahoo.com>.
There are cases when the appender creates directories and drops the log files if the directories dont exist..It is happening with log4j1.2.12..can you please help me?
James Stauffer <st...@gmail.com> wrote: The appenders don't create directories. Some people have made
appenders that create the directories. 1.3 might have something to
help with this.
On 11/14/05, Vin Karthik wrote:
> Hi All,
>
> I tried running log4j when the intermediate directories where the log giles need to be put are not in place. Ideally, it should create the directories and drop the log file in it's place. But it is not happening. Can someone let me know why is it behaving in this manner?
>
> Thanks
> Karthik
>
>
> ---------------------------------
> Yahoo! FareChase - Search multiple travel sites in one click.
>
--
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
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.
Re: Logging failing because the intermediate directories do not exist
Posted by James Stauffer <st...@gmail.com>.
The appenders don't create directories. Some people have made
appenders that create the directories. 1.3 might have something to
help with this.
On 11/14/05, Vin Karthik <vi...@yahoo.com> wrote:
> Hi All,
>
> I tried running log4j when the intermediate directories where the log giles need to be put are not in place. Ideally, it should create the directories and drop the log file in it's place. But it is not happening. Can someone let me know why is it behaving in this manner?
>
> Thanks
> Karthik
>
>
> ---------------------------------
> Yahoo! FareChase - Search multiple travel sites in one click.
>
--
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
Logging failing because the intermediate directories do not exist
Posted by Vin Karthik <vi...@yahoo.com>.
Hi All,
I tried running log4j when the intermediate directories where the log giles need to be put are not in place. Ideally, it should create the directories and drop the log file in it's place. But it is not happening. Can someone let me know why is it behaving in this manner?
Thanks
Karthik
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.