logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Atte A" <ata...@hotmail.com>
Subject RE: Multiple log files with SocketServer
Date Thu, 14 Jun 2001 06:49:24 GMT
Hi again,

By 'client group' I mean a group of EJB's. All the EJB's and the 
SocketServer reside on the same server machine. In that case I can't 
separate them by IP adress.

If I somehow could get the category name in SocketServer::main method (where 
it listens) I could look at the category name and log to different log files 
based on that. I mean instead of looking at the IP address (for example 
127.11.11.1) and then look in configDir if there is any configuration file 
called 127.11.11.1.lcf, I would like to look at the category name (for 
example traceCat) that did send the message to SocketServer and look for the 
config file traceCat.lcf.

Is there any other easier way of doing this, I mean log to files depending 
on the category? (Totally one log file per category.)



>When you say client group, do you mean different machines that are using
>socketAppender?
>
>If that is the case, you can give a directory as a command line argument
>(see javadoc on SocketServer) to socketServer. In this dir you can put
>several config files (hostname.lcf i.e, 192.215.113.16.lcf). The
>socketserver will read the appropriate config file and use it to log
>loggingEvent coming from the particular host. This way you can specify
>different files/appenders in each of the lcf files and the log will go to
>different files depending on the 'client group'
>
>Hope this helps :)
>
>-----Original Message-----
>From: Atte A [mailto:atay_a@hotmail.com]
>Sent: Wednesday, June 13, 2001 6:37 AM
>To: log4j-user@jakarta.apache.org
>Subject: Multiple log files with SocketServer
>
>
>Hi!      (Using Visual Age 3.5 on NT)
>
>I use SocketAppender and listen with SocketServer which logs to a file. It
>works well. But now I want to log to several files on server, depending on
>which "client group" that want to log.
>
>I use the SocketAppender in the following prop. config file (Trace1.lcf):
>
>log4j.rootCategory=DEBUG, SOCKETSERV
>
>log4j.category.org.apache.log4j.net=DEBUG
>log4j.appender.SOCKETSERV=org.apache.log4j.net.SocketAppender
>log4j.appender.SOCKETSERV.RemoteHost=localhost
>log4j.appender.SOCKETSERV.Port=9991
>
>
>I do the following in a method everytime to send messages to the socket:
>   PropertyConfigurator.configure("C:\\Trace1.lcf");
>
>   Category cat = Category.getInstance("SOCKETSERV");
>
>   cat.info("Tracing" + message);
>
>Is this the right way to do so?
>
>
>I have the following prop. config file (localhost.lcf) stated in
>SocketServer second argument in main():
>
>   log4j.rootCategory=debug, A1
>
>   log4j.appender.A1=org.apache.log4j.RollingFileAppender
>   log4j.appender.A1.File=C:\\localhost.log
>
>   log4j.appender.A1.MaxFileSize=1000KB
>   # Keep one backup file
>   log4j.appender.A1.MaxBackupIndex=5
>
>   log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>   log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss.SSS} - %m%n%n
>
>
>Every "client group" have to have a logfile that only belongs to that 
>group.
>
>How can I log to diffent files in SocketServer, one for each "client 
>group"?
>
>Do I have to have several SocketAppenders stated in my config file, one for
>each "client group"?
>
>Please...Help me...Don't hesitate to contact med directly.
>
>/Atte
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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


Mime
View raw message