Thinking about log4j performance

2003-12-11 Thread Yu Xiang Xi (Maveo)
It's known that log4j has a good performance even 'on an AMD Duron clocked
at 800Mhz running JDK 1.3.1' machine.

If I have lot of appenders, for example, a socket appender, which will cost
0.1 second to communicate with the socket server, and there's still a file
appender in the system all the same.

My puzzle is that, will socket appender and file appender work at the same
time?
Or run socket appender first, and AFTER socket appender done, file appender
later.
And the system will hold on till all the appenders are invoked?

Might it can be explained in the below assumption codes.
Assumption

methodA();  //(1)
logger.debug(hello,log4j) //(2) hold on till all appenders are invoked
one by one?
methodB();  //(3)


Best Regards
Xi Yuxiang
System Architect
Maveo Systems Limited - www.maveosystems.com
Email: [EMAIL PROTECTED] 

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



RE: Revamp: App-server independent log4j logging

2003-11-17 Thread Yu Xiang Xi (Maveo)
It's one of the most funny mail dialogues I have seen :)
Good Job, Jake!

BR
Xi Yuxiang
Nov. 18th, 2003

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED] 
Sent: 20031118 9:19
To: Log4J Users List
Subject: Re: Revamp: App-server independent log4j logging

At 01:16 PM 11/17/2003 +0100, you wrote:
I'm NOT stupid...

I hope.

I'm sure, not.

The reason I joined this mailing list was because I had a 
auto-configuration problem, but it went away... BUT now it's back. Oh
joy.

- I have Tomcat 4.1.12 with 1 context (my application).

you should upgrade.  4.1.29 is out and Tomcat-5, my personal favorite, is 
just about to be fully released as 5.0.15 (or whichever version they
decide).

- In my application I have
   * WEB-INF/lib/log4j.jar (latest stable)
   * WEB-INF/classes/log4j.properties

sounds about right.

- In the Tomcat directory is no log4j.jar or properties.

in the Tomcat directory?  What does that 
mean?  TOMCAT_HOME?  common/classes?  Where?  Also, it would be hard to 
guarantee that there is no log4j.properties anywhere in a place where 
Tomcat can see it such as an arbitrary jar file in common/lib or 
shared/lib.  You never know.  That's why I recommend against counting on 
auto-configuration.  It is there for convenience, but doesn't always 
provide what you need.  Anyway...

Now, if I start Tomcat with -Dlog4j.debug=true, I get NO debug output 
nor is my log4j.properties loaded, but I do not get log4j error messages 
about needing a log4j.properties (so it did find one), and there is log4j 
output being generated...

Why don't I get debug output?

That's a bit odd, I must say.

If I copy a log4j.jar into Tomcat/server/lib, I do get debug output, but 
then it says:

 log4j: Could not find resource: [null]

server/lib is not a place to put stuff for your webapp to see.  Even much 
of Tomcat's common stuff can't see server/lib.  for instance, common/lib 
can't see server/lib, although the converse is true.  Personally, I always 
put log4j.jar in common/lib and a log4j.xml (for server logging only) in 
common/classes.  I then have the choice of putting log4j.jar and log4j.xml 
in each webapp or just have log4j.xml in each webapp, do manual 
configuration, and use a repository selector to use the common log4j.jar in 
common/lib.

Why isn't it looking into my web-inf/classes?

It should, I'm not sure why it isn't.  Webapps look in the 
WebappClassLoader first before looking in a parent classloader (note that 
this is opposite to normal Java2 classloading behavior where the parent is 
usually searched first).  BTW, are you starting Tomcat up using the 
standard startup scripts or starting Tomcat as a service?  Because if it is 
the latter, then you should check your system classpath.  The startup 
scripts eschew the system classpath.  Running as a service won't.  The best 
policy here is to clean up your system classpath.  Mine is a single period 
and nothing else which avoids this whole issue whether or not I start via 
scripts or as a service.

Please, tell me I'm not stupid.

Again, you're not.  This classloader stuff can drive one insane.

Tom


Jake 


-
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: LoggingEvent.locationInfo

2003-11-04 Thread Yu Xiang Xi (Maveo)
Hi, Andreas

New a Throwable() will create the full stack trace information in the
throwable instance. The log4j parse the stack trace and get the
LocationInformation. But it's of no use to the class in the same package
with LoocationInfo(or LogEvent)

It's heavy burden to create lots of exceptions, so I do not recommend you
use this one if your system are time-critical.

Best Regards
Xi Yuxiang
System Architect
Maveo Systems Limited - www.maveosystems.com
Email: [EMAIL PROTECTED] 
-Original Message-
From: Andreas Bothner [ MTN - Innovation Centre ]
[mailto:[EMAIL PROTECTED] 
Sent: 2003114 15:17
To: Log4J Users List
Subject: LoggingEvent.locationInfo

Hi,
 
Looking at the source of the LoggingEvent class I see that the
getLocationInformation() method creates a new LocationInfo object using
a new Throwable, and not the throwable that might be referenced by the
LoggingEvent's member throwableInfo.  Considering that the LocationInfo
class searches the Throwable to obtain the location information when it
gets instantiated, I do not understand how it ever gets the location
information, because the throwable created by getLocationInfo() is
always empty?  
 
I must be missing something  can somebody point out to me what,
please.
 
Thank you
 
Andreas Bothner 
Systems Integrator
Mobile Telephone Networks - Information Systems 



NOTE: This e-mail message is subject to the MTN Group disclaimer see
http://www.mtn.co.za/email_disclaimer.asp

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



RE: How do I set the character encoding ?

2003-10-30 Thread Yu Xiang Xi (Maveo)
If you change 
static Logger logger = Logger.getLogger(Sort.class.getName());
to 
static Logger logger = Logger.getRootLogger();
you will see 'setEncoding called.' in the console.


-Original Message-
From: KUROSAKA Teruhiko [mailto:[EMAIL PROTECTED] 
Sent: 20031030 15:36
To: [EMAIL PROTECTED]
Subject: How do I set the character encoding ?

Hello,
I am new to the list, and to log4j.

It seems that log4j writes log in the encoding specified
by file.encoding property.  Is there a way to override this?
I would like to write my log files in UTF-8 encoding
regardless of the platform's locale setting.

Experimenting with Sort.java sample program, I thought
this would work:

  static Logger logger = Logger.getLogger(Sort.class.getName());
  
Enumeration appenders=logger.getAllAppenders();
if(appenders!=null){
if(!appenders.hasMoreElements()){
System.out.println(getAllAppender() returned zero-count
Enuml.\n);
}else{
while(appenders.hasMoreElements()){
Object o=appenders.nextElement();
if (o instanceof WriterAppender){
((WriterAppender)o).setEncoding(UTF-8);
System.out.println(setEncoding called.\n);
}
}
}
}else{
System.out.println(getAllAppender() returned null.\n);
}

But it doesn't because getAllAppenders() returns the NullEnumerator.

I am actually hoping that this can be done in configuration, like:

log4j.appender.R.encoding=UTF-8

Is there such luck ?

KUROSAKA Kuro Teruhiko




-
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: can log4j configuration file be sepearted into two...n files?

2003-10-23 Thread Yu Xiang Xi (Maveo)
Have you ever tested that?

I test the xml in myself, but it seems that it didn't work.
The DOMConfigurator did not validate this log4j.xml by declaring external
entities at the top.

-Original Message-
From: Elias Ross [mailto:[EMAIL PROTECTED] 
Sent: 20031023 11:52
To: Log4J Users List
Subject: Re: can log4j configuration file be sepearted into two...n files?

On Wed, 2003-10-22 at 19:58, Yu Xiang Xi (Maveo) wrote:
 Hello
  
 I have a question on the separation of log4j configuration file.

Use the XML property file format and declare external entities at the
top.

?xml version=1.0 encoding=UTF-8?
!DOCTYPE project [
   !ENTITY customer  SYSTEM ../customer.ent
   !ENTITY customer2 SYSTEM ../customer2.ent
]

log4j
   customer;
   customer2;
...



-
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]



Mapped Diagnostic Context in Struts Action Class

2003-10-22 Thread Yu Xiang Xi (Maveo)
Hi, this is a combination question about both log4j and struts.

For the MDC is managed on a per thread basis, we can use it to log the user
IP address in the web application.
While, as I remember, struts action class is designed to be thread-safe.
If I try to log the user IP address in the execute () method of struts
action class, 

For example
public ActionForward execute(ActionMapping actionMapping, ActionForm
actionForm,  HttpServletRequest request, HttpServletResponse response)
throws Exception {
   String username=session.getAttribute(user);
MDC.put(userip,request.getRemoteAddr());
logger.info(username+ login);
..
}

Will the unexpected case happen?

1. UserA from 192.168.0.1 login, and the MDC put 192.168.0.1 to the MDC
2. UserB from 192.168.0.2 login, and the MDC put 192.168.0.2 to the MDC(now
the userip in MDC  is updated)
3. UserA executed the code logger.info(username+ login);
4. UserA executed the code logger.info(username+ login);

so the log4j output maybe look like
[192.168.0.2] UserA login
[192.168.0.2] UserB login

Actually the assumption is
[192.168.0.1] UserA login
[192.168.0.2] UserB login

Best Regards
Xi Yuxiang

System Architect
Maveo Systems Limited - www.maveosystems.com

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



can log4j configuration file be sepearted into two...n files?

2003-10-22 Thread Yu Xiang Xi (Maveo)
Hello
 
I have a question on the separation of log4j configuration file.
 
As in a web application, I try to assemble all the customer changeable
properties (for example the log file location) into one file -
customer.properties.
 
The customer can decide where to log file can be placed, by changing
customer.properties. maybe he will be confused by looking at the log4j.xml
file. That's why I want to separate the log4j.xml into two or more files.
 
It's easy to separate log4j.properties, as there's a method
file:///I:\developer\jakarta-log4j-1.2.8\docs\api\org\apache\log4j\Property
Configurator.html#PropertyConfigurator() PropertyConfigurator.
file:///I:\developer\jakarta-log4j-1.2.8\docs\api\org\apache\log4j\Property
Configurator.html#configure(java.util.Properties) configure(
http://java.sun.com/products/jdk/1.3/docs/api/java/util/Properties.html
Properties properties) to load all the properties.
 
But now I want to transform to log4j.xml, to enjoy the convenience of XML
configuration (FILTER and more).
 
 
I have an idea of converting the customer.properties to customer.xml.
But is there a way of keeping the file location in customer.properties(said
above), and integrate the other part of log4j.xml?
 
 
Xi Yuxiang
 
System Architect
Maveo Systems Limited - www.maveosystems.com


RE: Problem with multiple appenders.

2003-10-14 Thread Yu Xiang Xi (Maveo)
How do you initial a logger in your java code?
It will use different loggers depends on that.
Anymore, the below parameters are useful for config that.
log4j.additivity.database=false/true

Best Regards
Xi Yuxiang
System Architect
Maveo Systems Limited
-
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.
 

-Original Message-
From: Sudarshan Krishnaprasad [mailto:[EMAIL PROTECTED] 
Sent: 20031014 3:27
To: Log4J Users List
Subject: Problem with multiple appenders.


Hi,
The log4j.properties file is as shown below. I have 2 appenders set and 
wish to log the different levels to different places.

log4j.properties

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

log4j.appender.R=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.R.URL=jdbc:mysql://localhost/test
log4j.appender.R.user=test
log4j.appender.R.password=test
log4j.appender.R.sql=INSERT INTO logTable 
(timestamp,priority,filename,msg) VALUES ('%d', '%p', '%c', '%m')

log4j.rootLogger=ALL, stdout
log4j.logger.database=ERROR, R

The problem I am having is that all the messages are getting logged at 
the console but none of them are getting logged to the database.
If I change the file a little bit and set the root logger to log at 
both the places like:

log4j.rootLogger=ALL, stdout, R

Now all the messages are logged in both the places. Could anyone please 
tell me if the above methods for having multiple loggers is correct.

Regards,
Sudarshan.



-
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.properties - How to parse outpu to multiple files

2003-10-09 Thread Yu Xiang Xi (Maveo)
Setting Threshold=ERROR can force log4j to log the higher priority loggings
of ERROR  FATAL, as demonstrated by Adrian Janssen said below.

But I'm wondering to know if there's a way to log only ERROR loggings, no
FATAL in one appender. That is, one appender to log only one level; not to
log one level and its higher levels.

Xi Yuxiang
System Architect
Maveo Systems Limited
-
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.
 

-Original Message-
From: Adrian Janssen [mailto:[EMAIL PROTECTED] 
Sent: 2003109 16:47
To: 'Log4J Users List'
Subject: RE: log4j.properties - How to parse outpu to multiple files

actually there is some filtering ability available in the normal properties
file, probably enough for you needs:

log4j.appender.MyAppender.Threshold=INFO

Cheers
Adrian

-Original Message-
From: Kevin Dougan [mailto:[EMAIL PROTECTED]
Sent: 09 October 2003 05:16
To: Log4J Users List
Subject: RE: log4j.properties - How to parse outpu to multiple files


Eureka! I have a solution! I now have my logging messages split out into the
4 types that I support: DEBUG, INFO, WARN  ERROR. My app-debug.log file
contains everything, down to my app-error.log file which only contains
errors!

Why is it that these moments tend to occur after midnight...   :-)

Note: I switched from log4j.properties to log4j.xml in order to take
advantage of filters, which aren't supported in the properties file.

Here's my log4j.xml file, enjoy:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'

appender name=STDOUT class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
/appender

appender name=DEBUG class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-debug.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
/appender

appender name=INFO class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-info.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=INFO /
/filter
   /appender

appender name=WARN class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-warn.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=WARN /
/filter
   /appender

appender name=ERROR class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-error.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=ERROR /
/filter
   /appender

root
priority value=debug/
appender-ref ref=STDOUT/
appender-ref ref=DEBUG/
appender-ref ref=INFO/
appender-ref ref=WARN/
appender-ref ref=ERROR/
/root

/log4j:configuration

-Original Message-
From: Kevin Dougan 
Sent: October 8, 2003 3:09 PM
To: [EMAIL PROTECTED]
Subject: log4j.properties - How to parse outpu to multiple files


Greetings log4j list!

I'd like my logging output to be sent to multiple files at once. 

RE: log4j.properties - How to parse outpu to multiple files

2003-10-09 Thread Yu Xiang Xi (Maveo)
Thanks, I find the below segment from log4j manual
   Note that filtering is only supported by the DOMConfigurator. The
PropertyConfigurator does not support filters.

That's a reason for me to migrate from log4j.properties to log4j.xml.

Best Regards
Xi Yuxiang
System Architect
Maveo Systems Limited
-
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.
 

-Original Message-
From: Kevin Dougan [mailto:[EMAIL PROTECTED] 
Sent: 2003109 21:05
To: Log4J Users List; [EMAIL PROTECTED]
Subject: RE: log4j.properties - How to parse outpu to multiple files

Simple!
Just add one LevelMax line, immediately after the LevelMin line, to
log4j.xml:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'

appender name=STDOUT class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
/appender

appender name=DEBUG class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-debug.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=DEBUG /
param name=LevelMax value=DEBUG /
/filter
/appender

appender name=INFO class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-info.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=INFO /
param name=LevelMax value=INFO /
/filter
   /appender

appender name=WARN class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-warn.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=WARN /
param name=LevelMax value=WARN /
/filter
   /appender

appender name=ERROR class=org.apache.log4j.RollingFileAppender
  param name=File value=C:\\logs\\app-error.log/
  param name=Append value=true/
  param name=MaxFileSize value=500KB/
  param name=MaxBackupIndex value=2/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%c %d{ISO8601}
-- %p -- %m%n/
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
param name=LevelMin value=ERROR /
param name=LevelMax value=ERROR /
/filter
   /appender

root
priority value=debug/
appender-ref ref=STDOUT/
appender-ref ref=DEBUG/
appender-ref ref=INFO/
appender-ref ref=WARN/
appender-ref ref=ERROR/
/root

/log4j:configuration

-Original Message-
From: Yu Xiang Xi (Maveo) [mailto:[EMAIL PROTECTED]
Sent: October 9, 2003 5:07 AM
To: 'Log4J Users List'
Subject: RE: log4j.properties - How to parse outpu to multiple files


Setting Threshold=ERROR can force log4j to log the higher priority loggings
of ERROR  FATAL, as demonstrated by Adrian Janssen said below.

But I'm wondering to know if there's a way to log only ERROR loggings, no
FATAL in one appender. That is, one appender to log only one level; not to
log one level and its higher levels.

Xi Yuxiang
System Architect
Maveo Systems Limited
-
This e-mail, including

RE: Nested Diagnostic Context

2003-10-09 Thread Yu Xiang Xi (Maveo)
Wow, if you do declare a logger by getRootLogger, you will lose the ability
to config different loggers for different module in the application.

Best Regards
Xi Yuxiang
System Architect
Maveo Systems Limited
-
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.
 

-Original Message-
From: Adam Vainder [mailto:[EMAIL PROTECTED] 
Sent: 2003109 22:41
To: Log4J Users List
Subject: Re: Nested Diagnostic Context

Whoops, the Logger declaration section was a copy+paste. You can do it 
either way, I usually prefer the getRootLogger. 

-Original Message-
From: Adam Vainder [EMAIL PROTECTED]
To: Log4J Users List [EMAIL PROTECTED]
Date: Thu, 09 Oct 2003 10:38:25 -0400
Subject: Re: Nested Diagnostic Context

 Hey,
 
 Brief example.
 
 jsp : 
 
 %@ page language=java contentType=text/html %
 %@ page import=org.apache.log4j.* %
 
 %--
 --%
 %-- Page initialization
 --%
 %--
 --%
 %!//make logger private static 
   //private static Logger log = Logger.getRootLogger();
   private static Logger log = Logger.getLogger(com.foo);
 %
 
 %
 String userHost=request.getRemoteHost();
   String userIp=request.getRemoteAddr();
   NDC.clear();
   NDC.push(userHost);
   NDC.push(userIp);
 %
 
 html
 head
   titleLOG EXAMPLE/title
 
 /head
 body
 %
 log.info(THIS IS A TEST);
 %
 !--whatever else you want to do--
 /body
 %
   NDC.remove(); //clear things up if not forwarding to another
 page, 
 otherwise omit this until the last page(s) the person can reach, 
 including error pages, etc.
 %
 /html
 
 
 Properties file :
 
 log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
 log4j.appender.A1.file=/opt/tomcat/webapps/foo.log
 log4j.appender.A1.MaxFileSize=100KB
 log4j.appender.A1.MaxBackupIndex=1
 log4j.appender.A1.layout=org.apache.log4j.PatternLayout
 log4j.appender.A1.layout.ConversionPattern==%d{MM-dd- HH:mm:ss}
 %-5p 
 %c %x - %m%n
 
 
 Should give something along the format :
   date and time INFO jsp-filename hostname ip-address (e.g. NDC 
 info) - THIS IS A TEST
 
 the %x in the ConversionPattern is what outputs the NDC.
 
 Does that help enough?
 
 Adam Vainder
 
 -Original Message-
 From: Sandeep [EMAIL PROTECTED]
 To: 'Log4J Users List' [EMAIL PROTECTED]
 Date: Thu, 9 Oct 2003 13:27:01 +0300 
 Subject: Nested Diagnostic Context
 
  
  
  Hi All ,
  
  DO any one have example or document using NDC (Nested Diagnostic
  Context)
  for webapplication as in jsp.
  
  TIA 
  
  
  
  Note
 
 ***
  *
  
  This email including any attachments is intended solely for the use
 of
  named
  recipient only.If you are not that person, you are not authorized to
  read,copy,forward,disclose,take any action on information.Any other
 use
  of
  this email and attachments is prohibited.The views expressed in this
  email
  are not necessarily those of BMA.If you received this email by
 mistake,
  please destroy all copies and contact  to the sender by email.your
  cooperation is appreciated.
  
 
 ***
  *
  *
  
  
  
  -
  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]

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



Questions on initial log4j instance

2003-09-29 Thread Yu Xiang Xi (Maveo)
I have seen different usage of initial log4j instance like below
private final static Logger logger = Logger.getLogger(some.name);
and
private final transient static Logger logger =
Logger.getLogger(some.name);
the second one has a additional keyword transient.

Which way is recommended?
Thanks in advance.

Best Regards
Xi Yuxiang
Maveo Systems Limited

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



Questions on Log4J LocationInformation

2003-09-26 Thread Yu Xiang Xi (Maveo)
Log4j has provided the interface org.apache.log4j.spi.LocationInfo.java,
which give us the chance to get where log event delivers from.

For example, if we use 
log4j.appender.Console.layout.ConversionPattern=%l %m%n
We can get information like below on the console screen

 JAVA DEBUG test.TestLog.main(TestLog.java:17) this is the log
information

But because the log4j manual tell us that using %l will extremely slow down
the speed of the whole application, so I just wonder to know how deep does
this affects our system, is there a way to measure the performance?

Thanks in advance.

Best Regards
Xi Yuxiang


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



RE: can't get log4j under tomcat working

2003-07-03 Thread Yu Xiang Xi (Maveo)
There's a console appender, which will output log information to the
console.

If you are running it in linux, you could output the console information to
a file.

Best Regards.
Xi Yuxiang


-Original Message-
From: Dean A. Hoover [mailto:[EMAIL PROTECTED] 
Sent: 200373 15:22
To: Log4J Users List
Subject: Re: can't get log4j under tomcat working

What console ? I am running linux. How do I see a console?

Ceki Glc wrote:


 Did you see any log4j output on the console? BTW, the console is 
 redirected by tomcat.

 At 03:15 AM 7/3/2003 -0400, Dean A. Hoover wrote:

 I did (see following updated file) and still no log file. Also,
 I am deploying using ant. Once I get this working, I don't
 really have to restart all of tomcat, do I?

 log4j.debug=true

 log4j.rootLogger=DEBUG, roll

 log4j.appender.roll=org.apache.log4j.RollingFileAppender
 log4j.appender.roll.File=/tmp/migrasponder.log
 log4j.appender.roll.MaxFileSize=100KB
 log4j.appender.roll.MaxBackupIndex=1
 log4j.appender.roll.layout=org.apache.log4j.PatternLayout
 log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n

 Dean Hoover

 Phillip Qin wrote:

 Put this line into your log4j.properties and restart Tomcat.

 log4j.debug=true

 -Original Message-
 From: Dean A. Hoover [mailto:[EMAIL PROTECTED] Sent: July 2, 
 2003 4:04 PM
 To: [EMAIL PROTECTED]
 Subject: can't get log4j under tomcat working

 I want to use log4j inside a tomcat application. According
 to the log4j short manual, all I have to do is drop my
 log4j.properties file into WEB-INF/classes and then I can
 just use it. This does not seem to be working. Can someone
 help?

 I added a log4.properties file to my .war file. Here's
 the toc:

  0 Wed Jul 02 15:59:12 EDT 2003 META-INF/
110 Wed Jul 02 15:59:10 EDT 2003 META-INF/MANIFEST.MF
  0 Wed May 14 01:06:28 EDT 2003 images/
  0 Wed Jul 02 10:10:36 EDT 2003 include/
  0 Tue Jul 01 15:18:38 EDT 2003 css/
   1210 Wed May 14 01:06:28 EDT 2003 login.jsp
485 Fri Jun 27 15:32:30 EDT 2003 welcome.jsp
   3008 Wed May 14 01:06:28 EDT 2003 images/email2.png
  15284 Wed May 14 01:06:28 EDT 2003 images/email.jpg
   1678 Mon Jun 30 02:16:40 EDT 2003 register2.jsp
   7020 Wed Jul 02 10:10:36 EDT 2003 include/contactinfo.jspf
   2287 Wed May 14 01:06:28 EDT 2003 contact.html
435 Fri Jun 27 15:38:58 EDT 2003 index.html
856 Mon Jun 30 13:25:12 EDT 2003 css/default.css
   1729 Mon Jun 30 01:55:04 EDT 2003 register1.jsp
   1203 Wed Jul 02 10:09:20 EDT 2003 register3.jsp
   1211 Tue Jul 01 02:40:44 EDT 2003 register4.jsp
  0 Wed Jul 02 15:59:12 EDT 2003 WEB-INF/
  0 Wed Jul 02 15:59:12 EDT 2003 WEB-INF/classes/
   3526 Wed Jul 02 15:59:10 EDT 2003 WEB-INF/classes/Login.class
  10418 Wed Jul 02 15:59:10 EDT 2003 WEB-INF/classes/Register.class
338 Wed Jul 02 15:59:10 EDT 2003 WEB-INF/classes/log4j.properties
  0 Wed Jul 02 15:59:12 EDT 2003 WEB-INF/lib/
  45386 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/activation.jar
 305434 Wed May 14 15:43:32 EDT 2003 WEB-INF/lib/mail.jar
 352668 Wed Jun 25 14:53:02 EDT 2003 WEB-INF/lib/log4j-1.2.8.jar
 107126 Wed Jul 02 13:56:56 EDT 2003 WEB-INF/lib/universal-common.jar
 460792 Wed Jul 02 13:56:58 EDT 2003 WEB-INF/lib/test.jar
  12914 Wed Jul 02 12:26:08 EDT 2003 WEB-INF/lib/migrasponder.jar
   1800 Wed May 21 09:53:30 EDT 2003 META-INF/context.xml
901 Wed Jul 02 15:15:56 EDT 2003 WEB-INF/web.xml

 The log4j.properties file looks like this:

 log4j.rootLogger=DEBUG, roll

 log4j.appender.roll=org.apache.log4j.RollingFileAppender
 log4j.appender.roll.File=/tmp/migrasponder.log
 log4j.appender.roll.MaxFileSize=100KB
 log4j.appender.roll.MaxBackupIndex=1
 log4j.appender.roll.layout=org.apache.log4j.PatternLayout
 log4j.appender.roll.layout.ConversionPattern=%d [%t] %-5p %F:%L - %m%n

 I using jakarta-tomcat-4.1.24 on RH9. I am not initializing log4j
 in any way, since in the short manual, it says I don't need to.
 I have liberally sprinkled log messages around, but I do not see
 the log file getting created. Any pointers on how to get this
 going?

 Dean


 -
 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]


 -- 
 Ceki  For log4j documentation consider The complete log4j manual
   ISBN: 2970036908  http://www.qos.ch/shop/products/clm_t.jsp

 -
 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: 

RE: NullAppender for Download

2003-06-18 Thread Yu Xiang Xi (Maveo)
If you set the log level to OFF, that is the same to null appender.

Best Regards.
Xi Yuxiang


-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: 2003618 20:54
To: Log4J Users List
Subject: RE: NullAppender for Download


Howdy,

I'm using log4j in my JSP project, which I want to provide on CD now.
As the logger cannot write to CD, I'm looking for the
org.apache.log4j.performance.NullAppender class to prevent
access-denied-errors.
I found several java-doc descriptions for the NullAppender but no site
where I could download the class.
Can anyone send me the file or a link to it?

Did you see the part of the JavaDoc, in red font, that says:
The org.apache.log4j.performance.NullAppender class is intended for
internal use only. Consequently, it is not included in the log4j.jar
file. ;) ;)

There's the org.apache.log4j.varia.NullAppender class that does come
with the distribution.

Neither I think is a good idea: why not just use a console appender
instead of the null one?

Yoav Shapira



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


-
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 within JSP

2003-06-17 Thread Yu Xiang Xi (Maveo)
Actually, there's no difference in using log4j in JSP.
Just add the log code in your JSP scripts.
Like 

logger.debug(your.message);

-Original Message-
From: Scott Burns [mailto:[EMAIL PROTECTED] 
Sent: 2003618 10:59
To: Log4J Users List
Subject: Log4j within JSP

Any Suggestions for using log4j from  a JSP?  I don't see any mention in
the manual.  For instance what fqcn do you use?  Any help would be
appreciated.  And I would recommend the book it is a great read and very
helpful 

Scott

-
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]