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: Expanding SocketServer
Date Fri, 15 Jun 2001 13:26:55 GMT
Hi!

Yes, the "grouping" is just my own convention.

Yes, you are right again - separate log's for separate applications. (My 
english is not perfect). If we have 3 applications, we want to have 3 log 
files.

I can't find any another approach than this, do you? I would appreciate if 
you shared it.

Yes, if I have a common class, this approach probably isn't the best, 
because then it writes to its own log file and not on the applications log 
file. Regardning the common classes, is there any chance that I could look 
at the threads ID or name and by that figure out which application log file 
it should write to?

Thanks in advance!

/Atay

>Atte,
>
>Okay I think I'm with you, but with just a couple of reservations in my
>mind.  These groups are not really programatic things, but are just your 
>own
>conventions right?
>
>But really what you're talking about is not so much having a log for each
>group, since you stated: "Each EJB group is actually an application and we
>want to have a separate log file for each application."  What you're really
>trying to achieve is separate log's for separate applications...
>
>Now this is a bit of a different issue.
>
>Again your approach will work, but you lose the benifits of controlling
>logging details because you essential have JUST ONE CATEGORY PER
>APPLICATION.  I'd personally find another approach, unless your 
>applications
>do very little logging, or are very small.
>
>If each application only uses classes in it's own package (or sub packages)
>you can get what you really want by attaching differnt appenders to each
>package(category) level.  If your applciations share a set of common 
>classes
>though (say a utility package) or they use a common set of session beans
>(like a shared service) this approach won't work.
>
>Other options would require more details on your app-server and your
>applicaitons in general.  (I think there is some appserver logging examples
>in teh distribution, I'm not sure how detailed they are though.)
>
>Regards
>
>John Volkar
>
>
>
>-----Original Message-----
>From: Atte A [mailto:atay_a@hotmail.com]
>Sent: Friday, June 15, 2001 7:45 AM
>To: log4j-user@jakarta.apache.org
>Subject: RE: Expanding SocketServer
>
>
>John,
>
>Thanks for the comments. Actually I have one log file per group of Session
>EJB's. Every one of theese groups of Session EJB's have the same category
>and therefor it logs to the same file. For every group i have a
>RollingFileAppender in generic.lcf.
>
>I have created a class that sends messages to the SocketServer. In one of
>the methods that sends the messages I do the following:
>
>pulic sendMessageToSocket(String message, String category)
>{
>   Category cat = Category.getInstance(category);
>   cat.info(message);
>}
>
>"X_EJB_1" and "X_EJB_2" call this method with category "X_EJB" and
>"Y_EJB_1" and "Y_EJB_2" call this method with category "Y_EJB"
>
>This way I have a stack trace for every EJB group. Each EJB group is
>actually an application and we want to have a separate log file for each
>application.
>
>Did I explain it understandbly?
>I think this way of doing it is good. What do you think?
>
> >From: John Volkar <jvolkar@etransport.com>
> >Reply-To: "LOG4J Users Mailing List" <log4j-user@jakarta.apache.org>
> >To: LOG4J Users Mailing List <log4j-user@jakarta.apache.org>
> >Subject: RE: Expanding SocketServer
> >Date: Fri, 15 Jun 2001 07:21:59 -0400
> >
> >Atte,
> >
> >I think what Ceki was trying to point out was that if a client makes a 
>call
> >on SessionBean SB1 and SB1 *uses* other beans, say SB2, SB3 and an
> >EntityBean EB1, your approach would yield screwy logs.  (I believe you
> >would
> >have had 4 log files per your example, SB1.log, SB2.lof SB3.log and
> >EB1.log.)
> >
> >Again your approach would work just fine, and perhaps you know that your
> >SB1
> >is entirly self contained (i.e. it does not make calls out to SB2, SB3 or
> >EB1) in which case it's fine.
> >
> >However, when dealing with log's it's often expected to see a 
>"stack-trace"
> >like effect in the log, where you would see in one log file, the original
> >call to SB1 and see immediatly after that the calls to SB2, SB3 and EB1, 
>in
> >the order that SB1 called and used them.  Now, again, if you do not care 
>to
> >see this "stack-trace" like effect, then your approach is just fine.
> >
> >(Ceki, was this what you were getting at?  Hope I did not muddy the 
>issue!)
> >
> >Regards
> >
> >John Volkar
> >
> >
> >
> >
> >-----Original Message-----
> >From: Atte A [mailto:atay_a@hotmail.com]
> >Sent: Friday, June 15, 2001 4:51 AM
> >To: log4j-user@jakarta.apache.org
> >Subject: Re: Expanding SocketServer
> >
> >
> >Ceki,
> >
> >I found a way to solve my problem without changing the code for
> >SocketServer
> >
> >or SocketAppender (thank you Seemantini Godbole). I created a generic.lcf
> >and added some categories and stated one log file per category (see 
>below).
> >
> >I want to separate logging per session bean type. Aktually per group of
> >session bean types.
> >
> >I don't see how NDC could help. It doesn't have any mechanism to create
> >several log files. It's for adding some extra info to the output. Am I
> >right?
> >
> >I dont really understand you when you say "you cannot guarantee that the
> >code called by the session beans will be in x or respectively y".
> >
> >In the EJB's I do theese two rows every time i log something:
> >     Category cat = Category.getInstance("EJB1");
> >     cat.info("message");
> >
> >Then I can be sure that it writes to the right file.
> >
> >Is this a good way of using log4j? I hope that I have explained
> >understandably.
> >
> >Best Regards and thank you for your help.
> >/Atay
> >
> >
> >***********************************
> >parts from generic.lcf:
> >***********************************
> ># Category EJB1
> >log4j.category.EJB1=debug, EJB1Log
> >log4j.appender.EJB1Log=org.apache.log4j.RollingFileAppender
> >log4j.appender.EJB1Log.File=C:\\EJB1.log
> >
> >log4j.appender.EJB1Log.MaxFileSize=1000KB
> >log4j.appender.EJB1Log.MaxBackupIndex=5
> >
> >log4j.appender.EJB1Log.layout=org.apache.log4j.PatternLayout
> >log4j.appender.EJB1Log.layout.ConversionPattern=%m%n%n
> >
> ># Category EJB1
> >log4j.category.EJB1=debug, EJB1Log
> >log4j.appender.EJB1Log=org.apache.log4j.RollingFileAppender
> >log4j.appender.EJB1Log.File=C:\\EJB1.log
> >
> >log4j.appender.EJB1Log.MaxFileSize=1000KB
> >log4j.appender.EJB1Log.MaxBackupIndex=5
> >
> >log4j.appender.EJB1Log.layout=org.apache.log4j.PatternLayout
> >log4j.appender.EJB1Log.layout.ConversionPattern=%m%n%n
> >
> >*******************************************************************
> > >
> > >
> > >Atay,
> > >
> > >As long as you can guarantee that you have one category across a
> > >SessionBean it should work but I am afraid you cannot guarantee that. 
>You
> > >did not specify if you wanted to separate logging per session bean type
> >or
> > >session bean instance or both. It does not matter actually.
> > >
> > >The logging code of XSessionBean and YSessionBean can be in categories 
>x
> > >and y but you cannot guarantee that the code  called by the session 
>beans
> > >will be in x or respectively y. Do you see what I mean?
> > >
> > >One approach is to use NDCs to separate logging output. Cheers, Ceki
> > >
> > >At 06:54 15.06.2001 +0000, Atte A wrote:
> > > >Ceki,
> > > >
> > > >- This is what we want to do:
> > > >We have several Session EJB's on Websphere. Each one of them have to
> >log
> > >to its own log file. Because we don't want to use java.io we want to 
>log
> > >via sockets.
> > > >
> > > >- This is how I first tried to do the above:
> > > >I used SocketAppender in each one of the EJB's and called cat.info().
> >The
> >
> > >socketServer (with RollingFileAppender in its config file) recieved the
> > >messages and logged to only one file. It worked well, besides that it
> > >logged everything in the same file and not on seperate files. (On log
> >file
> > >per EJB).
> > > >
> > > >- Then I tried to do this (expanding SocketServer And SocketNode):
> > > >I know that SocketServer can log to different files, but thats based 
>on
> > >the client IP adress. If there exist a config file in the configDir it
> >uses
> >
> > >that. I have changed that behavior so that it now looks at the category
> > >that originally did send the message to it and look for a file that
> >matches
> >
> > >the category (for example a file traceCat.lcf for category traceCat). I
> > >have one category per EJB.
> > > >
> > > >Any comments?
> > > >Will this way of solving my problem cause any trubble in the future?
> > > >
> > > >Thanks in advance...
> > > >
> > > >Regards
> > > >/Atay
> > > >
> > > >
> > > >
> > > >>From: Ceki Gülcü <cgu@qos.ch>
> > > >>Reply-To: "LOG4J Users Mailing List" <log4j-user@jakarta.apache.org>
> > > >>To: "LOG4J Users Mailing List" <log4j-user@jakarta.apache.org>
> > > >>Subject: Re: Expanding SocketServer
> > > >>Date: Thu, 14 Jun 2001 15:25:33 +0200
> > > >>
> > > >>
> > > >>Atay,
> > > >>
> > > >>I depends on what you want to achieve. Why don't you try describe 
>your
> > >problem in your words without referring to log4j components at all?
> > >Regards, Ceki
> > > >>
> > > >>At 13:14 14.06.2001 +0000, you wrote:
> > > >>>Hi!
> > > >>>
> > > >>>I have found a way to solve my problem and wonder if it's a good
> >idea.
> > >I have changed the code for SocketServer (And SocketNode a little 
>bit)in
> > >the following way:
> > > >>>
> > > >>>SocketServer is looking at the InetAdress and looks for files in
> > >configDir that matches to the host (for example if host 197.0.5.1 has a
> > >config file 197.0.5.1.lcf). I have changed that behavior to look at the
> > >category that originally did send the message to it and look for a file
> > >that matches the category (for example a file traceCat.lcf for category
> > >traceCat).
> > > >>>
> > > >>>Is there any other easier way of doing this?
> > > >>>Will this way of solving my problem cause any trubble in the 
>future?
> > > >>>
> > > >>>Please guide me...
> > > >>>
> > > >>>Regards
> > > >>>/Atay
> > >
> >
> >>>_________________________________________________________________________
> > > >>>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
> > > >>>
> > > >>
> > > >>--
> > > >>Ceki Gülcü
> > > >>
> > > >>
> > > 
> >>---------------------------------------------------------------------
> > > >>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
> > > >
> > >
> > >--
> > >Ceki Gülcü
> > >
> > >
> > >---------------------------------------------------------------------
> > >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
> >
> >---------------------------------------------------------------------
> >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
>
>---------------------------------------------------------------------
>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