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ü <[EMAIL PROTECTED]>
> >>Reply-To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> >>To: "LOG4J Users Mailing List" <[EMAIL PROTECTED]>
> >>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: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>
> >>--
> >>Ceki Gülcü
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >_________________________________________________________________________
> >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>--
>Ceki Gülcü
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]