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 kiran <sr...@gmail.com> on 2005/09/25 00:29:15 UTC

log4j issue

Hi All

Apache logger has support for logging into files through file appender. But, 
if my log file is existing on a different machine on the "intranet" and the 
log4j's logger is running on a different machine, how should i specify that 
network location in the log4j.properties? Also, Are there any the issues that 
are inherently present with this sort of remote logging.

2. Supposing that we define a new appender for logging onto a n/w file, how to 
conditionally instruct logger to log to that appender when a special case is 
satisfied? what i know is that when logging has to be done, apache logger does 
so dutifully to all the appeneders defined in the log4j.properties file 

thanks in advance!
kiran



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


Re: log4j issue

Posted by Curt Arnold <ca...@apache.org>.
On Sep 24, 2005, at 5:29 PM, kiran wrote:

> Hi All
>
> Apache logger has support for logging into files through file  
> appender. But,
> if my log file is existing on a different machine on the "intranet"  
> and the
> log4j's logger is running on a different machine, how should i  
> specify that
> network location in the log4j.properties? Also, Are there any the  
> issues that
> are inherently present with this sort of remote logging.
>
> 2. Supposing that we define a new appender for logging onto a n/w  
> file, how to
> conditionally instruct logger to log to that appender when a  
> special case is
> satisfied? what i know is that when logging has to be done, apache  
> logger does
> so dutifully to all the appeneders defined in the log4j.properties  
> file
>
> thanks in advance!
> kiran


You did not provide enough detail to answer the question.  If you are  
running on the Windows platform, you may use a UNC name to specify  
the file, however you need to escape the backslashes even in the XML  
configuration, resulting in a line like:

<param name="file" value="\\\\someserver\\somedir\\somefile"/>

If you are running some other network file system, then you should  
just use the appropriate file name.

Re: log4j issue

Posted by bussa srikanth <sr...@gmail.com>.
Hi James, ur reply helped me in exploring new things. thanks.
 say i already have an appender R defined in my log4j.properties to log to a
local file,
 #### appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=example.log
# Control the maximum log file size
log4j.appender.R.MaxFileSize=100KB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
 Now, if i want to log to a shared drive on windows, i define a new appender
like this:
 log4j.appender.shared=org.apache.log4j.RollingFileAppender
log4j.appender.shared.File=\\windowsshareddrive\filename
 Are the rules same here as a local file logging, specifically, do i still
have the options of specifying MaxBackupIndex, layout etc.,
 2. say i have a cluster of apps and thereby loggers on different machines,
now if all of them try to log onto the shared drive at the same millisecond,
i read that some of the logging requests will simply be dropped. Plz
comment.
 3. is there any way in which when i try to log, it ignores logging to this
shared drive appender and logs to all other appenders.
 in reverse,
say now, based on some condition check, say if my
int value for a variable x is 15, then i want to only log to the network
shared drive appender, and not to any of the other appenders defined.
  thanks in advance!

Re: log4j issue

Posted by James Stauffer <st...@gmail.com>.
1. Just make the remote location accessible through some type of share
or use a SocketAppender and socket server.

2. There are a few different ways of defining conditions.  What kind
of condition do you want?

On 9/24/05, kiran <sr...@gmail.com> wrote:
> Hi All
>
> Apache logger has support for logging into files through file appender. But,
> if my log file is existing on a different machine on the "intranet" and the
> log4j's logger is running on a different machine, how should i specify that
> network location in the log4j.properties? Also, Are there any the issues that
> are inherently present with this sort of remote logging.
>
> 2. Supposing that we define a new appender for logging onto a n/w file, how to
> conditionally instruct logger to log to that appender when a special case is
> satisfied? what i know is that when logging has to be done, apache logger does
> so dutifully to all the appeneders defined in the log4j.properties file
>
> thanks in advance!
> kiran
>
>
>
> ---------------------------------------------------------------------
> 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