Re: New To Log4j Please Help me.......

2004-06-04 Thread Jacob Kjome
At 04:26 AM 6/5/2004 +0100, you wrote:
Hi Friends,
I have Configured the Log4j in my Application and in my lib/ 
log4j-1.2.8.jar put the jar file. When I run this application i am getting 
the Error..
Where did you put the log4j.jar?  Are you using shared libraries such as 
when you put a library in shared/lib or common/lib or is everything in 
WEB-INF/lib?  We'll definitely need more information in order to figure out 
your issue.

Jake

That is ...
javax.servlet.ServletException: Servlet execution threw an exception

root cause
java.lang.NoClassDefFoundError: org/apache/log4j/Logger 
com.i2t2.mt.prod.action.LoginAction.(LoginAction.java:17) 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method) 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
java.lang.reflect.Constructor.newInstance(Constructor.java:274) 
java.lang.Class.newInstance0(Class.java:308) 
java.lang.Class.newInstance(Class.java:261) 
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231) 
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326) 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268) 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.

This is the Error I am getting now...
Please Help me to solve this problem
Thanks
Srinivas

Yahoo! India Matrimony: Find your partner online.

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


New To Log4j Please Help me.......

2004-06-04 Thread Srinivas
Hi Friends,
 
I have Configured the Log4j in my Application and in my lib/ log4j-1.2.8.jar put the 
jar file. When I run this application i am getting the Error..
 
That is ...
 

javax.servlet.ServletException: Servlet execution threw an exception



root cause 
java.lang.NoClassDefFoundError: org/apache/log4j/Logger 
com.i2t2.mt.prod.action.LoginAction.(LoginAction.java:17)   
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)   
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:274) 
java.lang.Class.newInstance0(Class.java:308)
java.lang.Class.newInstance(Class.java:261) 
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:231)  
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)   
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)   
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)



note The full stack trace of the root cause is available in the Tomcat logs.

 

This is the Error I am getting now...

Please Help me to solve this problem

Thanks

Srinivas

 


Yahoo! India Matrimony: Find your partner online.

RE: Using log4j for writing a library...

2004-06-04 Thread Jacob Kjome
At 09:06 AM 6/4/2004 -0400, you wrote:
   From another user's e-mail, there is a thread talking about detecting
if log4j is configured - is that advisable for a library?
Like I said previously, logging is not your concern, but your user's 
concern.  I see little reason for needing to detect whether it is 
configured or not.  As a user, even if it is configured once, you would 
want your own to take precedence.  So who cares if it has been configured 
previously.  However, if you insist on wanting to do this, the wiki has a 
way to detect if logging is configured (I see you found it in your second 
email).  Log4j-1.3, I believe, has a more robust mechanism to detect 
this.  You might want to try it.

   But from your mail - I am now sure of one thing. If by mistake, log4j
is configured a second time inside the library, the user's root logger
and other loggers would lose the settings from configuring the first
time.
   Is this a correct conclusion?
Yep, but only within the current logger repository.  If you haven't defined 
a repository selector, the only logger repository available will be the 
default one.  If you use a separate logger repository to do configuration, 
then you won't stomp on anyone else's configuration.

Jake 

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


Re: What is the significance of rootCategory in property file.

2004-06-04 Thread Narendra Babu Kirthi
Hi Yoav,
   Thanks alot for your valuble information.
Regards
Naren
Shapira, Yoav wrote:
Hi,
 

  Thanks alot for the information.
  Can I have any number of log4j properties files under a single web
application ?
   

Yes.  In case of conflicts the last one configured using
Configurator#configure (or a variant thereof) will determine the
configuration.
 

  If so, where to put these properties files under tomcat ?
   

Wherever you want.  To configure with multiple files you'll have to
configure log4j programmatically anyways, so put the files wherever you
want and adjust your code accordingly.
 

  Are there any guidelines that I have to follow if there are many
lo4j properties under a single web app ?
   

Nothing special.
Yoav

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]
 



Re: announce Level

2004-06-04 Thread Wascally Wabbit
The only problem I've had is that some Log4J viewers (aka appenders)
don't handle custom Levels. This is not a core log4j issue, but if
you intend to or already use GUI viewers, you might want to verify they
won't "translate" custom Levels into something like warnings or
debug messages...
At 04:49 AM 6/4/2004, you wrote:
Hello,
I havn't been following the latest list discussion concerning custom or a 
new log levels for log4j. So excuse me if this hass been discussed already.
[snip]

If nobody else does sees a need for this, is there somehting special we 
need to be aware of inside log4j in order to implement this as a custom level?
( do we have to dive inside and change source code of chainsaw, appenders 
like email,?) or is it pretty straight forward.

Thanks for any feedback
Marc
The Wabbit 


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


RE: Using log4j for writing a library...

2004-06-04 Thread Marepalli, Somesh
Hi:
   Thanks for the reply. In general, I noticed some undesirable effects
of using the default configuration when no configuration file is
provided:

a) it defaults to debug level when no configuration is done
b) it emits warning messages to the console

   I don't know the intent and purpose for the above, but I am sure
there's some good reason. For my use case, it does not fit the needs. 

   Hence, I am trying to use the approach of using an internal
.properties file used to explicitly configure log4j. But, I would not
like to do this till I am sure users of my library have not configured
log4j.

   I saw the snippet of code to detect if log4j is configured in 
   http://wiki.apache.org/logging-log4j/Log4JProjectPages/UsefulCode
   
   Thanks for the link. Is the code above the only reliable way to
detect if log4j (1.2.8) is configured?

Have other users tried this approach?

Regards
-Somesh

-Original Message-
From: WJCarpenter [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 04, 2004 1:27 AM
To: Log4J Users List
Subject: Re: Using log4j for writing a library...

>> I am writing a Java based library for which I am using the log4j
>> package (version 1.2.8)
>> a) Are there any special things we need to worry about
>> configuration.

Since you are writing a library, you have to be aware of what log4j
does by default if nobody does any configuration at all.  Here a
message thread that discusses it:

http://marc.theaimsgroup.com/?l=log4j-user&m=108326596313116&w=2
-- 
[EMAIL PROTECTED] (WJCarpenter)PGP 0x91865119
38 95 1B 69 C9 C6 3D 2573 46 32 04 69 D6 ED F3


-
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: Using log4j for writing a library...

2004-06-04 Thread Marepalli, Somesh
Hi:
   Thanks for the replies. I am planning to use the .properties file
internal to my .jar file (not using log4j default configuration).

   Also, as suggested below, I plan to write a config utility class with
static method. It is in this class I plan to use PropertyConfigurator
class

  However, instead of user invoking explicit API to configure with the
library provided logging .properties file, I would still like to decide
automatically when to use it. I would like to configure my library using
this internal .properties file when no other logging has been
configured. That's the use case which suits my library.

   From another user's e-mail, there is a thread talking about detecting
if log4j is configured - is that advisable for a library? 

   But from your mail - I am now sure of one thing. If by mistake, log4j
is configured a second time inside the library, the user's root logger
and other loggers would lose the settings from configuring the first
time.

   Is this a correct conclusion?

Thanks for all the replies...

Regards
-Somesh
 
At 05:33 PM 6/3/2004 -0400, you wrote:
>Hi:
>
> I am writing a Java based library for which I am using the log4j
>package (version 1.2.8)
>
>
>
> I am new to log4j. I am confused about the following points:
>
> a) Are there any special things we need to worry about
>configuration.
>
>Currently, I am considering configuration from a properties
file
>using the PropertyConfigurator class when the library
>
>initializes.

Sure.  You can use a properties file or XML file

>  I am planning to include a logging .properties file
>within my .jar file for the library.

Bad idea.  Logging is for your users, not for you (unless you are
*using* 
your library, of course)

>The case I am considering I when users (read as applications)
of
>my library may also be using log4j.

Exactly!  You can't know what your users want to log and if you provide
a 
default log4j.properties file in the classpath, then you may end up 
overriding a users own properties file causing the user excessive
confusion 
as to why Log4j isn't logging the way they have it configured.

>   I am not sure if I
>
>use PropertyConfigurator class without resetting logging
>configuration of a user in that case.

This is an even worse idea than providing a properties file which
*might* 
override a users.  In this case, you are programmatically configuring
Log4j 
and will almost certainly override a users logging configuration, again,

causing excessive confusion for the user.

If you want a compromise, you could maybe provide a default 
log4j.properties file, but don't put it in the root of the jar where
Log4j 
is looking for it.  Then provide a utility class with a static method
such 
as Log4jUtility.configureMyLibrary() which the user can call, if 
desired.  configureMyLibrary() would load up your properties file and 
programmatically configure Log4j.  Since this will be used only with the

user's clear intent, then there should be no confusion, keeping everyone
happy.

>Specifically, I would like all loggers within my library to be
at
>least at the WARN level. Is there a way I can ensure that
>
>even if I am writing a library.

The simple truth is that you shouldn't force your own concept of what
you 
want logged upon your users.  If users want to see logging from your
app, 
they can specify your package to be logged (as long as you stick to the 
standard naming conventions for loggers, eg
"com.mypackage.MyClass").

>
>
>b) For RollingFileAppender, is there a nice way to specify location
>of log file without hard-coding the path. I am interested in knowing
>what other library writers do in such cases.

Reference the name of a system property and make sure to provide that 
system property either programmatically (before any configuration of
Log4j 
happens) or via the command line such as:

java -Dlog_location=/path/to/log/directory MyClass

In the config file, have something like...

${log_location}/mylog.log

>
>
>Hope the user community can help me with these questions.

I hope I helped!

Jake

>
>
>regards
>
>Somesh Marepalli



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



RE: What is the significance of rootCategory in property file.

2004-06-04 Thread Shapira, Yoav

Hi,

>Thanks alot for the information.
>Can I have any number of log4j properties files under a single web
>application ?

Yes.  In case of conflicts the last one configured using
Configurator#configure (or a variant thereof) will determine the
configuration.

>If so, where to put these properties files under tomcat ?

Wherever you want.  To configure with multiple files you'll have to
configure log4j programmatically anyways, so put the files wherever you
want and adjust your code accordingly.

>Are there any guidelines that I have to follow if there are many
>lo4j properties under a single web app ?

Nothing special.

Yoav



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]



Re: announce Level

2004-06-04 Thread Ionel GARDAIS
Hi Marc,

I don't really get why do you need this ANNOUNCEment
level.

If a process does not start at all, you get no
messages.
If a process starts with errors or warnings, the team
is notified.
If a process starts successfully, then none of the
things above occured.

However, couldn't the last INFO message of your
startup sequence contain a special NDC to tell that
everything is OK or not ?

Then you could create an appender which react to this
NDC only ...


(since I am not a log4j power user, I might be
mistaken but this is how I would implement this if I
had to do it)

=
-- 
Regards,
Ionel






Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! 
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! 
Messenger sur http://fr.messenger.yahoo.com

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



Fw: log4j JMX implementation

2004-06-04 Thread Shirish Goel
 
- Original Message - 
From: shirish   
To: [EMAIL PROTECTED]   
Sent: Friday, June 04, 2004 3:45 PM
Subject: RE: log4j JMX implementation

Hi ,
 
I was going through the chain on this topic...but no body has mentioned
the bahavior of log4j running on different JVM's (Clustered environment)
First of all it is right that not all the servers would be able to
register the MBeans with the single admin mbean server because of object
name clash , even if they could do so lets say with different domain
names . How are the changes done on the console to log4j mbeans be
reflected every where on all the servers .(Notification mechanism)
 
Also the changes done on the console at the runtime and in memory
changes and are not getting persisted every where, so the next time the
server is booted all those changes done on the console will be lost  .
 
I am trying to use log4j with its own JMX implementation but found no
documentation at all for its usage , I know its beta release but was
expecting some comments / documentation .
 
Regards,
Shirish
 
 
 
 


Log4J and JMX

2004-06-04 Thread Shirish Goel
Hi,
I am trying to use log4J with JMX functionality in a clustered
environment,
Will it work.. I was looking at the src for Agent.java, where it is
creating its own mbean server ...then How is the
communication/notification model enabled for synchronizing the changes.
 
Thanks in advance
 
Regards,
Shirish
 
 


announce Level

2004-06-04 Thread Marc Oesch
Hello,
I havn't been following the latest list discussion concerning custom or 
a new log levels for log4j. So excuse me if this hass been discussed 
already.
But as we progrees using log4j in more and more production environments, 
we come across a usefull important features which in my opinion might be 
usefull for others as well.
Next to the current available levels, we see a need for another level 
which is related to announcements. We are running/starting important  
processes early in the morning and we need to get announcments whether 
they have been started and ran as required. These announcement are 
dipatched by email, pager 
Why should it be a new level:
It is important to know if some process started although this is not an 
error/warn/fatal.
Not receiving any error doesn't necessary mean that everything is ok 
simply the process might not have been started and is not sending any 
messages at all.
By announcing events, one knows all is ok for sure.
These ANNOUNCEments are not of type INFOrmal, we have already lots of 
INFO messages in the log files.
It is not of type ERROR, WARN, FATAL. these are dispatched differently 
(related to critical problem handling).

If nobody else does sees a need for this, is there somehting special we 
need to be aware of inside log4j in order to implement this as a custom 
level?
( do we have to dive inside and change source code of chainsaw, 
appenders like email,?) or is it pretty straight forward.

Thanks for any feedback
Marc
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: ObjectRenders

2004-06-04 Thread Søren Ehrhorn
Hello again,

So far so good, but i still have a problem. In the manual there is a
referense to a  configuration file, objectRendering.xml in chapter3 but its
not there! I dont know the structure of how its ment to be implementet. I
have a configuration file as listet here:

 




http://jakarta.apache.org/log4j/";>












 



I would like to be able to construct a render for my loggable objects but as
im trying to explain i wery bad english, i dont know how and there. Can you
help me?

Best regards
- Søren

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: 3. juni 2004 14:56
To: Log4J Users List
Subject: RE: ObjectRenders



Hi,
ObjectRenderers do not replace a Layout.  They are classes that know how to
render objects of a specific class.  For example:

class A {
  private int a;
  public int getA() { return a; }
   
  private int b;
  public int getB() { return b; }
}

public class ARenderer implements ObjectRenderer {
  public String doRender(Object o) {
if(o == null) {
  return null;
} else if {! (o instanceof A)) {
  return null;
} else {
  A obj = (A) o;
  return "Sum = " + (obj.getA() + obj.getB());
}
}

They are specified in a properties configuration file as follows:
log4j.renderer.A = ARenderer

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Søren Ehrhorn [mailto:[EMAIL PROTECTED]
>Sent: Thursday, June 03, 2004 7:36 AM
>To: '[EMAIL PROTECTED]'
>Subject: ObjectRenders
>
>Hi,
>
>Im trying to incorperate ObjectRenders in min J2EE framework, but i 
>dont know howto. Do they replase Layout??
>
>
>Regards,
>Søren
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




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]