You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Deepesh Jain <De...@intiqua.com> on 2002/11/07 05:04:46 UTC

Help Required on Log4J

Hi,

We are developing the project and in the same we will use Log4J for logging.
We will have the multi server environment.
My query is 
1)How  I will log my statements into one file resides on one server using
log4J when my application run on multiple servers?

I want to log statements into different files based on modules.Files name
will be decided at run time based on the part of application I want to log.
2)How I will give the name of the file at run time using log4J?


Thanks in advance I will appriciate a quick response.

Regards,

Deepesh

____________________________________________________
            INTIQUA International        
    Intelligent Solutions, Quality Execution
____________________________________________________
 
Note: The information and data contained in this message (and attachments)
may be privileged and confidential and protected from disclosure to any
party or parties apart from the intended recipient. If the reader of this
message is not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this
communication in error, please notify us immediately by replying to the
message and deleting it from your computer.



Re: Help Required on Log4J

Posted by Ricardo Moral <ri...@yahoo.com>.

--- Deepesh Jain <De...@intiqua.com> wrote:
> Hi,
> 
> We are developing the project and in the same we
> will use Log4J for logging.
> We will have the multi server environment.
> My query is 
> 1)How  I will log my statements into one file
> resides on one server using
> log4J when my application run on multiple servers?
> 

Log4j is based on Loggers and Appenders. Each logger
has one or many appenders. The logger will create a
Logging event and pass the event to the appenders wich
are the ones that must register the event on a
particular target. Some examples of appenders are:
FileAppender (for files), Console appender (for
System.out) and SocketAppender. This last appender is
the one you may use to log events to a remote server.
So you may have many servers logging to
SocketAppenders that are connected to a remote
SocketNode that also uses Log4j to register the remote
events locally.


> I want to log statements into different files based
> on modules.Files name
> will be decided at run time based on the part of
> application I want to log.
> 2)How I will give the name of the file at run time
> using log4J?
> 

There are many ways to configure Log4j. You may use
the PropertyConfigurator wich receives a Properties
object with the parameters used to create the Loggers,
Appenders, Etc. This properties object may be created
at runtime. Other way is to create the Loggers,
Appenders, and all the other components by hand
calling the methods each one of this components have
to configure themselves, for example you can create a
new appender and add this appender to a logger using
the <code>addAppender</code> method of the Logger
class.

> 
> Thanks in advance I will appriciate a quick
> response.
> 
> Regards,
> 
> Deepesh
> 
> ____________________________________________________
>             INTIQUA International        
>     Intelligent Solutions, Quality Execution
> ____________________________________________________
>  
> Note: The information and data contained in this
> message (and attachments)
> may be privileged and confidential and protected
> from disclosure to any
> party or parties apart from the intended recipient.
> If the reader of this
> message is not the intended recipient, or an
> employee or agent responsible
> for delivering this message to the intended
> recipient, you are hereby
> notified that any dissemination, distribution or
> copying of this
> communication is strictly prohibited. If you have
> received this
> communication in error, please notify us immediately
> by replying to the
> message and deleting it from your computer.
> 
> 
> 

Richard.


__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>