Re: log objects and use the values separately in the appenders wi th conversion pattern

2005-01-18 Thread Joerg Eggink
Hello Dirk
Thank you very much. That is exacly what I need.
Best Regards
Joerg

OOMS DIRK wrote:
You could map the 3 strings onto MDC key-value pairs, e.g. (m1, string1)
and address them in a PatternLayout by %X{m1}, etc.
Hope this is what you were looking for.
dirk
 

Dear All
Is it possible to log for example a object with 3 strings and 
refer it 
later in PatternLayout with e.g %m1 %m2 %m3 ?

Below there is some dummy code.
Thanks in advance for any hint.
Best Regards
Joerg

Example dummy code:
--
class MESSAGE{
public String a;
public String b;
public String c;
public message (String a, String b, String c)
{
this.a = a;
this.b = b;
this.c = c;
}
}
-
somewhere in the program

MESSAGE message new MESSAGE (hello, log, reader);

logger.getLogger(CategoryName).log(WRAPPER_FQN, Level.INFO, 
message,null);


in the log4j.xml
 appender ...
   layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern
  value=%m1 %m2 %m3) /
  /layout



As output from the appender
hello log reader






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread James Stauffer
I have seen info on how to use log4j for Tomcat and I have seen info
on how to use log4j for a web app, but I haven't seen info on how to
use log4j for Tomcat logging with a separate config for each app.  I
am having troubles getting that to work.  Does anyone know of a web
page that explains that?
-- 
James Stauffer
http://www.geocities.com/stauffer_james/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread OOMS DIRK
AFAIK there will be only one log4j configuration per Tomcat. If you want to
differentiate logging behavior between your applications you either:
- have a Logger per application
OR
- if you already have a Logger per class, you could make use of the
hierarchy in log4j and change logging behavior on some intermediate node of
this hierarchy (the 'root' of your application) 



 
 I have seen info on how to use log4j for Tomcat and I have seen info
 on how to use log4j for a web app, but I haven't seen info on how to
 use log4j for Tomcat logging with a separate config for each app.  I
 am having troubles getting that to work.  Does anyone know of a web
 page that explains that?
 -- 
 James Stauffer
 http://www.geocities.com/stauffer_james/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread James Stauffer
I am unable to get that to work.  If there is no web site that
explains how to do that then I can post what I have tried and what
happened.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread Joerg Eggink
Hi  James
Did you try the following:
1. add log4j.jar to your application WEB-INF/lib
2. add log4j.xml to your WEB-INF/classes
3. connect from your application with e.g.
private static Logger logger = null;
logger.getLogger(CategoryName).log(CategoryName, Level.INFO, message,null);
I remeber that log4j configures itself if the configuration file is in 
WEB-INF classes. May be some other person knows more about it.

Best Regards
Joerg

James Stauffer wrote:
I am unable to get that to work.  If there is no web site that
explains how to do that then I can post what I have tried and what
happened.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread James Stauffer
I have log4j.jar in WEB-INF/lib and common/lib (so Tomcat can use it).
I have log4j.xml in WEB-INF/classes and common/classes.
It appears that once it is configured once for Tomcat it won't do it
for the app.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread James Stauffer
On Tue, 18 Jan 2005 19:10:29 +0100, Ceki Gülcü [EMAIL PROTECTED] wrote:
 Have a look at this document:
 
http://www.qos.ch/logging/sc.jsp
 
 Following that, CVS check out log4j 1.3 and consult the examples
 located under ./examples/tiny-webapp/


Does that work with 1.2.9?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: log4j for Tomcat and separate log4j config for each web app

2005-01-18 Thread Jacob Kjome
Quoting Ceki Gülcü [EMAIL PROTECTED]:


 James,

 Have a look at this document:

http://www.qos.ch/logging/sc.jsp


 Following that, CVS check out log4j 1.3 and consult the examples
 located under ./examples/tiny-webapp/

 Although the documentation in ./examples/tiny-webapp/ is up to date,
 certain important details in log4j 1.3 ContextJNDISelector have
 changed.  I have not recently tested the code in
 ./examples/tiny-webapp/. Thus, it may contain some small
 errors.


I think there is an error in the tiny-webapp docs because there is no more
automatic configuration of non-default logger repositories in Log4j-1.3, which
the tiny-webapp assumes.  Please correct me if I'm wrong about this.


Jake

 I hope this helps,

 At 03:33 PM 1/18/2005, James Stauffer wrote:
 I am unable to get that to work.  If there is no web site that
 explains how to do that then I can post what I have tried and what
 happened.

 --
 Ceki Gülcü

The complete log4j manual: http://www.qos.ch/log4j/



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]