Re: WIN2K and Linux, not same behavior on Rolling File Appender in Servlets

2003-12-20 Thread Jacob Kjome
The behavior you see on Win2k is to be expected assuming that the JVM was 
started from the location G:\jakarta-tomcat-5.0.16.  If you provide a 
relative path for the log file, the path will be relative to wherever the 
JVM started.  If you want the file to go somewhere specific on your system 
and not be relative to where the JVM was started, then provide a fully 
qualified path.

I'm not sure about the behavior on Linux.  Are you sure that the user which 
started Tomcat has sufficient rights to write the log file?  Note that it 
is up to you to make sure that the directory that you are writing log files 
to actually exists.  Log4j won't create them for you and you would get 
exactly this behavior.  Note also that the location from where the JVM 
started on Linux might be different than on Windows.

I would suggest creating an environment variable which is referenced in 
your log4j.properties file which you can set when start the JVM for 
Tomcat.  This will make it so you can provide a fully qualified path to the 
directory to write log files and not have to change your properties file 
when going between Windows and Linux.  Eg
log4j.appender.LOGFILE.File=${log4j.log.home}/ftp.log

Then run Tomcat with something like this...
run_tomcat.sh -Dlog4j.log.home=/valid/path/to/an/existing/directory
Jake

At 05:43 PM 12/19/2003 -0800, you wrote:
I had a demo this week using a WAR file that i deployed many times on
Windows with great results. This week using the same WAR file on Linux for
the first time, EVERY LOGGER Call threw an exception   $%^#  not my best
week for demos.
some hypothesis follows and i would greatly appreciate expert guidance on
this...
Note that jar log4j-1.2.8.jar contains PropertyConfigurator.class and that
this jar is in the  following 2 WebApp directories under Tomcat/BASE...
NOTE ALSO that NONE of the Tomcat Common, shared, endorsed libs contain
log4j-1.2.8.jar.
#1
[EMAIL PROTECTED] /cygdrive/g/jakarta-tomcat-5.0.16
$ find -name log4j-1.2.8.jar
./webapps/axis/WEB-INF/lib/log4j-1.2.8.jar
./webapps/ftp-examples/WEB-INF/lib/log4j-1.2.8.jar
-
static code for log4j configuration that i use in every class...
#2
 static
{
log = Logger.getLogger((this.class).getName());
PropertyConfigurator.configure(
this.class.getClassLoader()
.getResource(
config/log4j.properties
)
);
}
- log4j.properties file (elided) -
#3
# LOGFILE is set to be a File appender using a PatternLayout.
#log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.File=logs/ftp.log-- linux 
exception on this
-- File does 
NOT EXIST

-  Behavior of War deployed on Windows...

NOTE that the code at #2 operates in a Web app. and will load
PropertyConfigurator class from the jar located at that webapp's context (
webapps/this.context/WEB-INF/lib/log4j-1.2.8.jar ).
However, in Windows, the crazy feature is that the fileAppender from #3 gets
written NOT at the Webapp's context , but a Tomcat's BASE as in
G:\jakarta-tomcat-5.0.16\logs. This seem's impossible to me??
---  Behavior of War deployed on Linux...

every log.debug() call throws a file does not exist ( logs/ftp.log )
exception. Why is this? Like on Windows example above, here the Linux path
jakarta-tomcat-5.0.16/logs exists but the system never writes the appender
there.
Its as if on Linux, the only place it will try to write the appender is to:
   webapps/this.context/logs/ftp.log and since there is no logs directory
under each
web context, the error is thrown...
Since the WAR file does not define a path under every WEBAPP that includes
this.context/logs , all the logger calls throw exceptions...


-
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: Tomcat log4j .

2003-12-17 Thread Jacob Kjome
You need to do a LogManager.shutdown() upon application shutdown.  That will 
solve problems with Log4j keeping handles on files.  Use a Servlet Context 
Listener for this.

Jake

Quoting Antony Paul [EMAIL PROTECTED]:

 Hi all,
 I am using Tomcat 4.1.27 + log4j 1.2.8+Win2k sp4. I have some problems
 with it.
 1, Log4j locks the log file so that I  cannot clear the content of the file.
 After some time I want to delete old debugging data while development.
 Currently I am doing it by shutting down Tomcat. It is time consuming job.
 2, After a context reload in Tomcat, if anyting is written to log the editor
 dont say that the file is changed.  It is not changing the last modified
 date of the log file.
 log4j jar file is in application's  WEB-INF\classes\lib directory.
 log4j.properties is in WEB-INF\classes
 No initialisation servlet is there.
 Some questions
 1, What is the SSS in the ConversionPattern means ?
 2, Is it necessary to initialise log4j through a servlet ?.
 
 rgds
 Antony Paul.
 
 
 
 -
 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 Multiple Log Files

2003-12-10 Thread Jacob Kjome
Something like this should work.  Notice the filter elements (copied from 
some earlier post on the user list)

appender name=FILE class=org.apache.log4j.FileAppender
param name=File value=debug_and_info.log/
param name=DatePattern value=_MMdd_HHmm/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%p - %m%n /
/layout
filter class=org.apache.log4j.varia.LevelRangeFilter
 param name=LevelMin value=DEBUG/
 param name=LevelMax value=INFO/
/filter
/appender
appender name=STDOUT
class=be.belgacom.mobile.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=%p - %m%n /
/layout
filter class=org.apache.log4j.varia.LevelMatchFilter
 param name=LevelToMatch value=ERROR/
/filter
/appender
root
level value=debug/
appender-ref ref=FILE/
appender-ref ref=STDOUT/
/root
For your case, just have a couple different file appenders with the 
appropriate filtering you want on each and add all those appenders to you 
root logger.

Jake

At 07:46 AM 12/10/2003 -0600, you wrote:
Is is possible to be able to log messages to multiple log files based upon
the severity of a message?  For instance could I log Errors to a Errors.log
and Warnings to a Warnings.log?
Thanks for the help,

Marty

-
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: Multiple Applications using Log4j in an App server clashing

2003-12-07 Thread Jacob Kjome
You have a 3 choices...

1.  Don't provide log4j.jar and log4j.properties for each 
application.  Instead, use the single server-provided instance of Log4j 
along with a single log4j config file (again, at the server level).  You 
would initialize Log4j once on server startup, not for each application 
running in the server.

2.  Do as above, but (as far as providing logj4.jar an the log4j config 
file at the sever level), but initialize log4j with a repository selector 
so that each application can configure itself in its own environment 
separate from that of other applications.  There are existing repository 
selectors in the log4j-sandbox project.

3.  Provide log4j.jar in WEB-INF/lib and your config file in 
WEB-INF/classes (or elsewhere for manual configuration) and make sure your 
server supports servlet-spec recommended classloader behavior where the 
WebappClassLoader is search for classes  before the parent.  This is 
intentionally opposite to that of normal Java2 class loading 
behavior.  Tomcat supports this.   I know JBoss can be configured to 
support this as well.  I can't say much about other servers.

See also:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging
Jake

At 09:50 AM 12/6/2003 +, you wrote:
Hi,

I am trying to deploy an web application that uses Log4J in a shared 
hosting environment (ATG Dynamo 5.6.1). Log4J is used by other web 
applications already deployed in the server. Log4J is in the server classpath.

When I deploy my application, it hijacks the logging of the other 
applications. Its my understanding that ATG 5.6.1  is Servlet 2.2 
compliant so it is probably using JDK standard classloading rules (always 
ask the parent classloader to load the class first). So when an 
application ask for Log4J classes the application's classloader ask it's 
parent and so on and eventually find the log4J instance loaded from the 
server classpath. So my guess is Log4J classes are shared between all 
applications. When  my application loads it must be reconfiguring that 
Log4J instance. (this is just a hunch !)

I have log4j.properties in WEB-INF/classes dir and log4j Jar in 
WEB-INF/lib directory. Is there anyway I could share the log4J instance 
with other applications without reconfiguring existing loggers ?

Or anyother pointers to resolve this issue is greatly appreciated.

Thanks
Roshan
_
Express yourself with cool emoticons - download MSN Messenger today! 
http://www.msn.co.uk/messenger

-
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 SMTP Appender Tomcat trouble

2003-12-03 Thread Jacob Kjome
mail.jar shouldn't be in WEB-INF/lib as it is an endorsed library (anything 
java.* javax.*, org.xml.*, org.w3c.dom.*).  Put it in 
CATALINA_HOME/common/lib or endorsed.  This allows Tomcat to use the mail 
api as well as your apps and will avoid troubles when/if the JDK actually 
includes the mail api (does the J2EE jar include it?). Of course, this 
probably isn't your immediate problem.

Is Log4j getting configured under Tomcat for you?  That is, are you getting 
output in other appenders?  If not, get that going first, and then try to 
get the Mail appender working.  Where is 
log4j.properties?  WEB-INF/classes?  Are you configuring it manually?  It 
may have been in the classpath of your IDE, but not of your webapp.  Just 
things to check out.

Jake

At 02:00 PM 12/3/2003 +0100, you wrote:
Hello,
I'm trying to use the SMTP Appender of log4j 1.2.8 with the following
configuration :
### Logger Mail ( SMTP Appender )
log4j.logger.Mail=DEBUG, Mail
log4j.appender.Mail=org.apache.log4j.net.SMTPAppender
log4j.appender.Mail.BufferSize=4096
log4j.appender.Mail.From=zz
[EMAIL PROTECTED]
log4j.appender.Mail.Subject=
log4j.appender.Mail.SMTPHost=zz..zzz
log4j.appender.Mail.layout=org.apache.log4j.SimpleLayout
log4j.appender.Mail.layout=org.apache.log4j.PatternLayout
log4j.appender.Mail.layout.ConversionPattern=%d[%c{1}i %x] %m%n
under Eclipse using a simple test class I receive the mail. When I try to do
the same under Tomcat 4.1.29 / JDK 1.4 nothing append : no mail, no dump. I
use the same mail.jar ( the jar is in WEB-INF/lib for Tomcat ) on both test
case.
Please advise,
Regards,
Jardin Xavier.
-
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 initialization with struts?

2003-12-03 Thread Jacob Kjome
I don't remember receiving this error with the previous version of log4j.
Do I need to do something different?
Maybe you should try an earlier version of Log4j and verify this 
statement.  I'm guessing you'll get the same behavior.  Try adding 
debug=true to your log4j:configuration below.  Also, you probably 
shouldn't use priority.  Use level only.

Jake

At 05:30 PM 12/3/2003 -0500, you wrote:
Hello all,

I am receiving the following error message from log4j.

WARNING: CORE3283: stderr: log4j:WARN No appenders could be found for logger
(org.apache.struts.util.PropertyMessageResources).
WARNING: CORE3283: stderr: log4j:WARN Please initialize the log4j system
properly.
I have placed log4j-1.2.8.jar in the WEB-INF/lib directory and have placed
the following log4j.xml in my WEB-INF/classes directory:
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j=  http://jakarta.apache.org/log4j/
http://jakarta.apache.org/log4j/;
appender name=ConsoleAppender
class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.SimpleLayout/
/appender
logger name=ct
level value=DEBUG/
/logger
root
priority value =WARN /
appender-ref ref=ConsoleAppender/
/root
/log4j:configuration
I don't remember receiving this error with the previous version of log4j.
Do I need to do something different?
Thanks,

Joshua



This communication, including attachments, is for the exclusive use of
addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all 
copies.


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


Re: Log4j configuration.

2003-11-27 Thread Jacob Kjome
You keep insisting on using non-url syntax for your setup even when you 
reference the correct URL syntax.  Do this...

java -Dlog4j.configuration=file:/c:/jarfiles/log4j.properties
org.pdfbox.searchengine.lucene.LucenePDFDocument C:\\pdf\h6603lab4.pdf
Also, why are you saying...
c:\\jarfiles\log4j.properties
You are escaping the first \, but not the second one in the 
path.  Shouldn't it be?...
c:\\jarfiles\\log4j.properties

Anyway, you have to use the URL syntax above for things to work.  BTW, I've 
also seen the URL file syntax on Windows be...
file:///c:/jarfiles/log4j.properties

Use whichever one works for you.

Jake

At 05:01 PM 11/27/2003 +0800, you wrote:
Hi,

I put my log4j.properties file in c:\\jarfiles and I did the following:

java -Dlog4j.configuration=c:\\jarfiles\log4j.properties
org.pdfbox.searchengine.lucene.LucenePDFDocument C:\\pdf\h6603lab4.pdf
But I get the following:

log4j:WARN No appenders could be found for logger
(org.pdfbox.pdfparser.PDFParser).
log4j:WARN Please initialize the log4j system properly.
I read the manual at

http://jakarta.apache.org/log4j/docs/manual.html

It says the following needs to be done for Tomcat 4:

For example:
set CATALINA_OPTS=-Dlog4j.configuration=file:/c:/jarfiles/log4j.properties
In the environment variables.
And I did just that.
Can I do the following?
java -Dlog4j.configuration=c:\\jarfiles\log4j.properties
org.pdfbox.searchengine.lucene.LucenePDFDocument C:\\pdf\h6603lab4.pdf
I can choose the ignore the error message but I would like to solve this 
problem
before moving on.
Anyone can help?


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


Re: Multiple Log4j configuration files in EJB Container (one jvm)

2003-11-23 Thread Jacob Kjome
At 04:02 PM 11/23/2003 -0500, you wrote:
Hi,
I don't know whether anyone has answered this already (I could not 
find).  I am using Websphere application server 5.0 (EJB Container).  I am 
using log4j for the logging in my ejb's.  I have created a start up bean 
(special case of a stateless session bean that is called first by the 
container) to configure the log4j (which writes all the logs to a JMS 
topic) and I have a MDB that reads from the topic and writes to flat files 
(there I read another the log4j configuration file). since all these beans 
are deployed in the same container and loaded by the same class loader, I 
was wondering would there be any collisions between these two log4j 
configuration files?
You are configuring things explicitly and not counting on 
auto-configuration.  As such, the various properties files shouldn't 
collide.  However, each time you perform a configuration with Log4j, the 
previous one will be wiped out; within the same logger repository (in the 
same class loader, of course), that is.

wondering anyone come across this scenario?
If you are needing configuration for two different components and want to 
different properties defined for each within the same class loader, then 
you will have to use a repository selector so that they don't trample on 
each other.

thanks,
Srini
Jake 

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


Re: setting up multiple log4j configurations for multiple WAR pac kage s?

2003-11-22 Thread Jacob Kjome
No, his statement is incorrect.  You can utilize a repository selector to 
separate logging using a single instance of log4j.jar.  Read here...

http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

In fact, if you use Tomcat, even without using a repository selector, you 
can provide for container logging and webapp logging, all completely 
separated.  Put log4j.jar in CATALINA_HOME/common/lib, put a log4j.xml in 
CATALNIA_HOME/common/classes, and then put log4j.jar in each WEB-INF/lib 
and either do manual configuration with log4j.xml somewhere like WEB-INF or 
do auto-config with it in WEB-INF/classes.  All your logging should be 
separated without even bothering with a repository selector.  This behavior 
depends on the way the class loaders are set up, though.  Tomat loads 
classes and resources from the WebappClassLoader preferentially to higher 
class loaders.  This is opposite the normal Java2 class loader behavior, 
but defined (I believe) by the servlet spec.  Other containers such as 
JBoss don't seem to do this by default, although you can configure them to 
do it.  As such, using the repository selectors is the only guaranteed way 
to achieve separated logging.

Jake

At 04:01 AM 11/22/2003 -0800, you wrote:
So if the server itself uses log4j for logging, does that mean that you 
will not be able to configure individual web apps to work independently of 
each other and or the server?

On Friday, November 21, 2003, at 07:36 AM, [EMAIL PROTECTED] wrote:

IMHO, the simplest and easiest configuration to maintain is to place
log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR.  This
should work fine without any additional server configuration.  You should
not have log4j.jar in your server's classpath or logging won't be separate
between webapps.
Ken

-Original Message-
From: Yuzwa, Erik [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2003 8:30 AM
To: 'Log4J Users List'
Subject: setting up multiple log4j configurations for multiple WAR
package s?
Hi all,

I'm sorry if this is a FAQ, as I've looked everywhere and
can't find very
many
resources on setting up multiple log4j configurations for
different WAR
packages
(ie. a seperate set of log files for each WAR app).
I've tried including a log4j.xml and log4j.blah.jar file with
each WAR, but
that
doesn't seem to work properly.
Is there a configuration setting that I'm missing on the
servlet container
itself?
Should the log4j.blah.jar file be in the classpath of the
servlet container
or
remain on the application layer?
thanks!

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


RE: setting up multiple log4j configurations for multiple WAR pac kage s?

2003-11-21 Thread Jacob Kjome
Does JRun not load from the WebappClassLoader first?  Tomcat does this, and 
I believe the servlet spec defines this behavior (but don't quote me on 
that).  Sounds like the same thing JBoss does by default.  The way Tomcat 
works makes things much easier to work with since libraries in the server 
won't mess up your webapp which has its own versions locally with the 
webapp.  I'll be JRun can be configured to load from the WebappClassLoader 
first.  Might want to look at see.  Otherwise, you can do configuration 
yourself and use a repository selector from the log4j sandbox.  Search the 
archives and the Wiki for more info on using repository selectors in 
application servers.

Jake

At 09:21 AM 11/21/2003 -0700, you wrote:
Hi Ken,
Thanks for the reply.
That's a good idea, and that should (logically) work.

We're using JRun as our servlet engine, and I've discovered that on a global
level, it loads up a log4j.properties file which is buried in one of the
.jars that ships with the product. This one seems to be trumping all of the
ones defined in the WAR packages.
I'm attempting to remove it in order to keep the logging at an application
level, so we'll see how that goes.
I'd also like to ask if there was a way to specify where to dump said log
files? If we have multiple WAR packages all configured to use log4j, we'd
like them to be dumped at a location of our choosing (rather than a location
chosen by the application), for security reasons.
Is this possible?

ie. maybe setup a global log4j.properties file which defines a filepath for
all child log4j.xml objects?? *shrug*
IS this even possible?

thanks again!

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2003 8:37 AM
To: [EMAIL PROTECTED]
Subject: RE: setting up multiple log4j configurations for multiple WAR pac
kage s?
IMHO, the simplest and easiest configuration to maintain is to place
log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR.  This
should work fine without any additional server configuration.  You should
not have log4j.jar in your server's classpath or logging won't be separate
between webapps.
Ken

 -Original Message-
 From: Yuzwa, Erik [mailto:[EMAIL PROTECTED]
 Sent: Friday, November 21, 2003 8:30 AM
 To: 'Log4J Users List'
 Subject: setting up multiple log4j configurations for multiple WAR
 package s?


 Hi all,

 I'm sorry if this is a FAQ, as I've looked everywhere and
 can't find very
 many
 resources on setting up multiple log4j configurations for
 different WAR
 packages
 (ie. a seperate set of log files for each WAR app).

 I've tried including a log4j.xml and log4j.blah.jar file with
 each WAR, but
 that
 doesn't seem to work properly.

 Is there a configuration setting that I'm missing on the
 servlet container
 itself?
 Should the log4j.blah.jar file be in the classpath of the
 servlet container
 or
 remain on the application layer?

 thanks!

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


Re: Problem with adding double quotes in a conversion pattern for PatternLayout specified in an XML configuration

2003-11-21 Thread Jacob Kjome
Have you tried quot;

Jake

At 04:47 PM 11/21/2003 +0100, you wrote:
Hi everyone,

I have a problem with adding double quotes in a conversion pattern for 
PatternLayout specified in an XML configuration.

Let's see the XML configuration fragment :

appender name=AuditActivityFileAppender 
class=org.apache.log4j.FileAppender
param 
name=File  value=${ginko.rootdir.as.file}/logs/audit_activity.log /
param name=Appendvalue=true /
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern 
value=%d{ISO8601}%m%n/
/layout
/appender

I would like to surround the date generated by %d{ISO8601} with double 
quotes like %d{ISO8601}, in order to output 01:15:23 instead of the 
plain 0115:23 ... BUT XML delimiter is this double quote !
Thus a XML parsing error occurs !! How can I do ? Do you have any escape 
sequence for the special character , such as %q (like Quote) ?
I can't find any solution.
Thank you in advance ...

Sébastien



-
An electronic message is not binding on its sender.
Any message referring to a binding engagement must be confirmed in writing 
and duly signed.
-

-
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: Revamp: App-server independent log4j logging

2003-11-17 Thread Jacob Kjome
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]


RE: how to use env vars in log4j.properties file

2003-11-14 Thread Jacob Kjome
This functionality exists in log4j sandbox as an appender+servlet context 
listener.  It sends app logging info to the same log file which is 
configured for your servlet context.  Here is what the config looks like...

in log4j.xml...

appender name=ServletContext 
class=org.apache.log4j.servlet.ServletContextLogAppender
param name=servletContextPath value=/Barracuda /
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%-4r [%t] %-5p %c %x - 
%m%n/
/layout
/appender

in web.xml...

listener
listener-class
org.apache.log4j.servlet.ServletContextLogAppenderListener
/listener-class
/listener
The param servletContextPath is simply the context path of your 
webapp.  This is the same way as you would configure a context for Tomcat 
(eg... Context path=/Barracuda ).  Additionally, in Tomcat, you might 
want to configure the log file for your context such as

Context path=/Barracuda docBase=Barracuda
 debug=5
Logger
className=org.apache.catalina.logger.FileLogger
prefix=localhost_Barracuda_servlet_log.
suffix=.txt
timestamp=true /
/Context

All log output for the /Barracuda context will go to 
CATALINA_HOME/logs/localhost_Barracuda_servlet_log.[current date].txt

Jake

At 02:35 PM 11/14/2003 -0500, you wrote:
I tried - they don't work either.
- Praveen
Shapira, Yoav wrote on 11/14/2003, 2:25 PM:

 
  Howdy,
  I guess you're assuming log4j automatically reads environment properties
  into an env. prefix scheme like Ant? ;)  Try just environment variable,
  e.g. $CATALINA_HOME or ${CATALINA_HOME}.
 
  Yoav Shapira
  Millennium ChemInformatics
 
 
  -Original Message-
  From: Praveen Alavilli [mailto:[EMAIL PROTECTED]
  Sent: Friday, November 14, 2003 2:22 PM
  To: Log4J Users List
  Subject: how to use env vars in log4j.properties file
  
  Hi,
  I am trying to configure a DailyRollingFileAppender for my test app.
  I want to set the log file to be in my server's (tomcat) log dir along
  with other log files. But if set the File path as
  
  log4j.appender.MyappLog.File=${env.CATALINA_HOME}/logs/myapp.log
  
  it throws this error:
  
  log4j: setFile called: /logs/myapp.log, true
  log4j:ERROR setFile(null,true) call failed.
  java.io.FileNotFoundException: /logs/myapp.log (No such file or
  directory)
  
  Is there any ther way to get this working apart from hard coding the
  file name/dir ?
  
  thanks in advance
  Praveen
  
  
  -
  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]


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


Re: Using level (was: Re: Re: Appender logging to 2 logs - how to stop it)

2003-11-10 Thread Jacob Kjome
At 08:40 AM 11/10/2003 -0500, you wrote:
Hello,

One more question about the use of level element.
What is its parent element?
logger or root (which is the root logger)

Also, I thought that one controls the level at which logging
should start by using appender's param sub-element, like
this:
appender name= class=...
  param name=Threshold value=INFO/
  ...
/appender
I thought this meant log at INFO level or above (WARN, ERROR,
FATAL), but do not log below it (DEBUG).
Am I wrong?
Not completely.  These are slightly different concepts, though.  level is 
used to set the logger priority where using threshold on an appender 
creates a filter for loggers with certain levels.  The threshold filter is 
useful when defining multiple appenders for a logger or set of 
loggers.  You do the same sort of filtering if you create an appender 
without a threshold filter and use...

root
level value=info/
appender-ref ref=myappender/
/root
Is that actually dictated by the level element?  If so, what
is the purpose of this Threshold parameter?
see above.

Thank you,
Otis
Jake






Get your own 800 number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag
 On Fri, 07 Nov 2003, Jacob Kjome ([EMAIL PROTECTED]) wrote:


 1.  You should use logger, not category
 2.  If you don't want to inherit logging from the root
logger, you should
 add additivity=false to the UserTracker logger
 3.  You might want to set the level's you prefer as well

 Jake

 At 12:06 PM 11/7/2003 -0500, you wrote:
 Hello,
 
 I am using log4j 1.2.8 (under JBoss).  I'm having a problem
with
 one of my Appenders logging to multiple log files, even
though I
 didn't configure it to do this.
 
 Here is how I configured it:
 
 appender name=MyUserTracker
 class=..DailyRollingFileAppender
param name=File value=/../tracker.log/
param name=Threshold value=INFO/
param name=Append value=true/
param name=DatePattern value=../
 
layout class=org.
  param name=ConversionPattern value=/
/layout
 /appender
 
 category name=UserTracker
appender-ref ref=MyUserTracker/
 /category
 
 
 That is it.
 
 The log4j.xml also contains configs for several other
appenders,
 and contains this:
 
 root
appender-ref ref=CONSOLE/
appender-ref ref=FILE/
 /root
 
 CONSOLE is a ConsoleAppender catching System.out and FILE is
a
 DailyRollingFileAppender going to a different log file.
 
 
 It seems to me like messages going to my UserTracker
appender
 are somehow getting saved into the CONSOLE appender.
 Nothing in my code prints to System.out.
 
 I have not been able to figure this out for a looong time.
 Does anyone know how to prevent this from happening?
 
 Thanks,
 Otis
 
 
 
 Get your own 800 number
 Voicemail, fax, email, and a lot more
 http://www.ureach.com/reg/tag
 

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


Re: automatic reload

2003-11-09 Thread Jacob Kjome
look at configureAndWatch() in the configurators.

However, I wouldn't use this in a container as the thread will run until 
the JVM is shut down.  There is no manual way to stop it.

Look for Mark Womack's watchdogs in the next version of Log4j for a better 
solution.  Here's an old message with some actual code showing how it 
works.  Check the latest CVS, though, as things have probably changed...
http://marc.theaimsgroup.com/?l=log4j-userm=101656353725142w=2

Jake

At 01:52 PM 11/9/2003 +0100, you wrote:
I know there is a parameter which can be used to specifiy that log4j must 
reload a configuration file (checking every so often). But I prefer 
autoconfiguration. AFAIK it is not possible to set autoreload from a 
configuration file, correct?

Tom



-
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: How do I do to change the properties file forlog4jintoanother directory?

2003-11-07 Thread Jacob Kjome
getting resources from WEB-INF is specific to a servlet application.  If 
you need to get the config file from both places, then put your config file 
back into WEB-INF/classes/config.  At that point, the code below will work 
and you can change your path in the servlet example to this...

context.getResource(/WEB-INF/classes/config/log4j.properties);

Jake

At 04:07 PM 11/7/2003 +1100, you wrote:
Jake,

Using your suggestion, I have able to make my Log4j servlet reading the
correct properties in /WEB-INF/config dir.
I know this is a bit out of track, but in another java bean file, I am
using InputStream. Is it a way to change to use the URL just like the
Log4j method which you have pointed out? as I am not able to get it read
from /WEB-INF. Thank you.
public class ConnectionManager implements HttpSessionBindingListener
{
  private Connection connection;
  private Statement statement;
  private String driver = ;
  private String dbURL = ;
  private String login = ;
  private String password = ;
 static public void main(String[] args)
  {
  ConnectionManager cm = new ConnectionManager();
  } // main
 public ConnectionManager()
  {
   Properties Prop = new Properties();
   try {
  InputStream configStream =
getClass().getResourceAsStream(/config/database.properties);
  Prop.load(configStream);
  configStream.close();
   } catch(IOException e) { System.out.println(Error: Cannot laod
configuration file );}
   driver =Prop.getProperty(driver);
   dbURL = Prop.getProperty(dbURL);
   login = Prop.getProperty(login);
   password = Prop.getProperty(password);
}

 [EMAIL PROTECTED] 07/Nov/2003 12:19:45 pm 

It would help if you actually obtained your servlet context.  Right
now, it
is null.
ServletContext context = this.getServletContext()

Jake

At 10:47 AM 11/7/2003 +1100, you wrote:
Jake,

Thank you for your time. I have made the changes to the code as you
have suggested. It compiled without problem. However, it does not
seems
to initiate the Log4j Tag Library. Have I missed out anything?

TJ


package com.log;

import org.apache.log4j.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Log4jInit extends HttpServlet {

 public void init() {

try {

ServletContext context = null;
   URL url =
context.getResource(/WEB-INF/config/log4j.properties);

   BasicConfigurator.configure();
   BasicConfigurator.resetConfiguration();
   PropertyConfigurator.configure(url);

   } catch (MalformedURLException e) { e.printStackTrace();}

  Logger logger = Logger.getLogger(getClass());
  logger.info(Logging system initialised successfully);

  }


public void doGet(HttpServletRequest req, HttpServletResponse res) {
}

}


  [EMAIL PROTECTED] 07/Nov/2003 10:21:59 am 

You need to look at my code closer.  context is a ServletContext.
You
can use it to access stuff anywhere in the webapp.

URL url = context.getResource(/WEB-INF/config/log4j.properties);
PropertyConfigurator.configure(url);

And, of course, you can also use the InputStream way if you want, but
the
URL way is a bit simpler.

One thing to note.  In my original code, I had forgotten to prefix
WEB-INF
with a /.  That is fixed in the code above.

Jake

At 09:59 AM 11/7/2003 +1100, you wrote:
 Jake,
 
 Putting the properties file under /web-inf/config is what I really
 wanted to achieve, but I am not be able to make it work. I uses the
 following to initialised the log4j package.
 
 
 
 package com.log;
 
 import org.apache.log4j.*;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 
 public class Log4jInit extends HttpServlet {
 
 
  public void init() {
 
String servletContainer = getServletContext().getRealPath(/);
 
   // The exact path to the config file is in servlet mapping
   String file = getInitParameter(log4j);
   Logger logger = Logger.getLogger(getClass());
 
   // if the log4j-init is not set, then no point in trying
   if (file != null) {
 
   BasicConfigurator.configure();
   BasicConfigurator.resetConfiguration();
PropertyConfigurator.configure(servletContainer+file);
 
   // Sent into to system.log
   logger.info(Logging system initialised successfully);
 
   }
 
 
  }
 
  public void doGet(HttpServletRequest req, HttpServletResponse
res)
 {
  }
 
 }
 
 I uses the following for my database properties which I have no
luck
in
 getting it to read /web-inf/config too:
 
 Properties Prop = new Properties();
 try {
 
InputStream configStream =
 getClass().getResourceAsStream(/config/database.properties);
 Prop.load(configStream);
configStream.close();
 
 } 

Re: Appender logging to 2 logs - how to stop it

2003-11-07 Thread Jacob Kjome
1.  You should use logger, not category
2.  If you don't want to inherit logging from the root logger, you should 
add additivity=false to the UserTracker logger
3.  You might want to set the level's you prefer as well

Jake

At 12:06 PM 11/7/2003 -0500, you wrote:
Hello,

I am using log4j 1.2.8 (under JBoss).  I'm having a problem with
one of my Appenders logging to multiple log files, even though I
didn't configure it to do this.
Here is how I configured it:

appender name=MyUserTracker
class=..DailyRollingFileAppender
  param name=File value=/../tracker.log/
  param name=Threshold value=INFO/
  param name=Append value=true/
  param name=DatePattern value=../
  layout class=org.
param name=ConversionPattern value=/
  /layout
/appender
category name=UserTracker
  appender-ref ref=MyUserTracker/
/category
That is it.

The log4j.xml also contains configs for several other appenders,
and contains this:
root
  appender-ref ref=CONSOLE/
  appender-ref ref=FILE/
/root
CONSOLE is a ConsoleAppender catching System.out and FILE is a
DailyRollingFileAppender going to a different log file.
It seems to me like messages going to my UserTracker appender
are somehow getting saved into the CONSOLE appender.
Nothing in my code prints to System.out.
I have not been able to figure this out for a looong time.
Does anyone know how to prevent this from happening?
Thanks,
Otis

Get your own 800 number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag
-
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: Problem with logging separation between webapps and container

2003-11-06 Thread Jacob Kjome
At 04:30 PM 11/6/2003 +0100, you wrote:
That seems a good advice but what can I do in the case of a connection
pooling shared by each webapp?  Actually, I cannot put these classes in each
app.
The repository selector in each webapp works fine, but how do I use the
repository selector for the server logging (like connection pooling)?
many thanks

Steph
You never answered my question about how your repository selector 
distinguishes between logger repositories.  Also, you don't have log4j.jar 
in WEB-INF/lib of any of your webapps, do you?  That would cause Log4j not 
to see the shared classes in the parent classloader.  In your case, I 
recommend removing any log4j.jar files and any jars containing the 
repository selectors from WEB-INF/lib of any and all webapps and putting 
log4j.jar and the jar containing your selectors in CATALINA_HOME/common/lib.

As far as general server logging, you can put a log4j.xml in 
CATALINA_HOME/common/classes and let the server use the default logger 
repository.  Each webapp can use its own config file, but you'll have to 
set the repository selector and configure the repository from your 
webapps.  You can use my log4j servlet context listener to do 
this.  Otherwise, you can set something up in the container to set the 
repository selector before any webapps get deployed.

Try all that and let me know how things work.

Jake


-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: November 6, 2003 12:50 AM
To: Log4J Users List
Subject: Re: Problem with logging separation between webapps and
container


I'd listen to Yoav here and keep your libs with each app.  However, I'm
wondering why this isn't working for you.  What does your repository
selector use to distinguish different logger repositories?  Are you sure it
is actually being used by your webapp?  Note that commons-logging does some
crazy stuff and could be interfering here.  commons-logging is almost
reason enough to avoid using Struts, if you ask me (but you didn't, so I
won't go on).
I've done plenty of testing where log4j.jar is in a global classloader
which many webapps use and the repository selector stuff works like a charm
to separate logging without having to put log4j.jar in each
webapp.  However, I haven't much tested the case where those webapps share
other libraries in a global classloader, simply because it isn't a very
controllable environment for a webapp.  Maybe you can keep testing to make
sure your repository selector is doing what you think it is doing but, in
the end, I'd still follow Yoav's advice.
Jake

At 10:18 PM 11/5/2003 +0100, you wrote:
I'm using Resin Servlet Container.  I have developed librairies(jar files)
that are shared by many web applications, I have put my libraries jar in
the
global classpath of the servlet container.  In those librairies, I'm using
log4j as logging mechanism with an xml configuration file.  Everything was
working fine.

The problem I have is when I used log4j with Struts in a webapp.  There is
a
conflict, only the logging from the webapp works.  I understand that this
is
a ClassLoader issue as described in the lo4j documentation.

I don't want to configure my libraries logging in each webapp but having
this kind of logging configured at the server level.

To fix the problem, I tried implementing a custom repository selector
(taken
from the sandbox by Jacob Kjome) in my webapp so that both hierarchies
worked at the same time without any conflicts.  Even though it's supposed
to
fix the problem, the webapp logging overwrites the server appenders.  I
have
this warning:

log4j:WARN No appenders could be found for logger (DbController.class).
log4j:WARN Please initialize the log4j system properly.
log4j: Finalizing appender named [CONSOLE].

Any ideas on how to make this work?

thank in advance,


Stephanie St-Cyr
Software developer
AstraZeneca

here is my two xml configuration files:

the server one:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd

log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
  debug=true

appender name=CONSOLE class=org.apache.log4j.ConsoleAppender
 layout class=org.apache.log4j.PatternLayout
   param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p
line %L -%m%n/
 /layout
/appender

root
level value=DEBUG/
appender-ref ref=CONSOLE /
/root

!-- database logger --
logger name=com.codestudio.util.PoolSkimmerThread
additivity=false
  level value=INFO /
  appender-ref ref=CONSOLE /
/logger
logger name=com.azrdm.util.DbControler  additivity=false
  level value=DEBUG /
  appender-ref ref=CONSOLE /
/logger

/log4j:configuration

and the webapp:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd

log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
  debug=true
 appender name=X class

RE: Problem with logging separation between webapps and container

2003-11-06 Thread Jacob Kjome
At 05:39 PM 11/6/2003 +0100, you wrote:

You never answered my question about how your repository selector
distinguishes between logger repositories.
What do you mean by this?  Should I do something special in your solution
ContextClassLoaderSelector that you put in the sandbox?
There is both a ContextClassLoaderSelector and a 
ContextJNDISelector.  Which one do you use?  Actually, from what you had 
written, it seemed to me that you wrote your own based on what I wrote and 
didn't use exactly what I wrote, so I was wondering what you did.

Oh, you  know what, I bet you are using a very old version of all this 
stuff.  I recommend an upgrade.  Check out the latest log4j-sandbox 
stuff.  You can control which selector you use by doing this

context-param
!-- preferred repository selector. preferred because if one
 is already installed, this choice is ignored. --
param-namelog4j-selector/param-name
param-valueorg.apache.log4j.selector.ContextJNDISelector/param-value
/context-param
context-param
!-- relative path to config file within current webapp --
param-namelog4j-config/param-name
param-valueWEB-INF/log4j.xml/param-value
/context-param
context-param
param-namelog4j-cron/param-name
param-value0/param-value
/context-param
listener
listener-class
org.apache.log4j.servlet.InitContextListener
/listener-class
/listener
...
...
...
env-entry
descriptionJNDI logging context for this webapp/description
env-entry-namelog4j/logging-context/env-entry-name
env-entry-valueSomeStringUniqueForThisContext/env-entry-value
env-entry-typejava.lang.String/env-entry-type
/env-entry
Using the JNDI selector might make things less susceptible to hard-to-debug 
classloader issues.

Also, you don't have log4j.jar
in WEB-INF/lib of any of your webapps, do you?  That would cause Log4j not
to see the shared classes in the parent classloader.  In your case, I
recommend removing any log4j.jar files and any jars containing the
repository selectors from WEB-INF/lib of any and all webapps and putting
log4j.jar and the jar containing your selectors in
CATALINA_HOME/common/lib.
Done.

As far as general server logging, you can put a log4j.xml in
CATALINA_HOME/common/classes and let the server use the default logger
repository.
That is exactly what I do.

  Each webapp can use its own config file, but you'll have to
set the repository selector and configure the repository from your
webapps.  You can use my log4j servlet context listener to do
this.
Based on below, I would move your log4j.xml into WEB-INF, and move it out 
of WEB-INF/classes.  That will get rid of any confusion with automatic 
configuration.

Beyond what I've told you, I'm really not sure why your server config stops 
being output.  It makes me think that, somehow, the separate repository 
isn't being used when the webapps configure themselves.  You'll have to 
test some things out.  Not sure I can help much more here.

Jake




I'm using your servlet context listener with this in my web.xml:

---
!--==
  - Log4j config parameters
  ==--
context-param
param-namelog4j-selector/param-name
param-valueorg.apache.log4j.selector.ContextClassLoaderSelector/param-val
ue
/context-param
context-param
param-namelog4j-config/param-name
param-valueWEB-INF/classes/log4j.xml/param-value
/context-param
context-param
param-namelog4j-cron/param-name
param-value0/param-value
/context-param
listener

listener-classorg.apache.log4j.servlet.InitContextListener/listener-class

/listener
---
Otherwise, you can set something up in the container to set the
repository selector before any webapps get deployed.
For this solution, I have to investigate more on how to achieve this with
Resin.
Try all that and let me know how things work.

Jake

here's my resin console output

log4j: Threshold =null.
log4j: Level value for root is  [DEBUG].
log4j: root level set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Parsing layout of class: org.apache.log4j.PatternLayout
log4j: Setting property [conversionPattern] to [%t %d{hh:mm:ss} %c %M %p
line %L
 -%m%n].
log4j: Adding appender named [CONSOLE] to category [root].
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [com.codestudio.util.PoolSkimmerThread] additivity to
[false].
log4j: Level value for com.codestudio.util.PoolSkimmerThread is  [INFO].
log4j: com.codestudio.util.PoolSkimmerThread level set to INFO
log4j: Adding appender named [CONSOLE] to category
[com.codestudio.util.PoolSkim
merThread].
log4j: 

Re: How do I do to change the properties file for log4j intoanother directory?

2003-11-06 Thread Jacob Kjome
You need to look at my code closer.  context is a ServletContext.  You 
can use it to access stuff anywhere in the webapp.

URL url = context.getResource(/WEB-INF/config/log4j.properties);
PropertyConfigurator.configure(url);
And, of course, you can also use the InputStream way if you want, but the 
URL way is a bit simpler.

One thing to note.  In my original code, I had forgotten to prefix WEB-INF 
with a /.  That is fixed in the code above.

Jake

At 09:59 AM 11/7/2003 +1100, you wrote:
Jake,

Putting the properties file under /web-inf/config is what I really
wanted to achieve, but I am not be able to make it work. I uses the
following to initialised the log4j package.


package com.log;

import org.apache.log4j.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Log4jInit extends HttpServlet {

public void init() {

  String servletContainer = getServletContext().getRealPath(/);

 // The exact path to the config file is in servlet mapping
 String file = getInitParameter(log4j);
 Logger logger = Logger.getLogger(getClass());
 // if the log4j-init is not set, then no point in trying
 if (file != null) {
 BasicConfigurator.configure();
 BasicConfigurator.resetConfiguration();
  PropertyConfigurator.configure(servletContainer+file);
 // Sent into to system.log
 logger.info(Logging system initialised successfully);
 }

}

public void doGet(HttpServletRequest req, HttpServletResponse res)
{
}
}

I uses the following for my database properties which I have no luck in
getting it to read /web-inf/config too:
Properties Prop = new Properties();
   try {
  InputStream configStream =
getClass().getResourceAsStream(/config/database.properties);
   Prop.load(configStream);
  configStream.close();
   } catch(IOException e) {

  System.out.println(Error: Cannot laod configuration file );
 }
Do you have a sample code that works? Thank you.

TJ



 [EMAIL PROTECTED] 06/Nov/2003 04:33:59 pm 
At 11:29 AM 11/5/2003 +1100, you wrote:
I am using the Log Tag Library 1.0 from Jakarta Project.

In the Installation document, it suggest that in order to initialize
Log4j automatically, the log4j.properties file will have to be placed
in
/WEB-INF/classes.

How could I put the log4j.properties file in /WEB-INF/classes/config
directory? What do I have to do?

Thank you.
If you are going to create a config dir, why not do it directly under

WEB-INF rather than where classes are put?  You can load up an input
stream
using context.getResourceAsStream(WEB-INF/config/log4j.properties)
and
feed that info a Properties object, then send that into
PropertyConfigurator.configure(Properties) or load up a URL using
context.getResource(WEB-INF/config/log4j.properties) and send that
info
PropertyConfigurator.configure(URL).
Of course you can still do this even if you leave the config
directory
under WEB-INF/classes and use the same technique above.  Whatever you
feel comfortable with.  I just like not cluttering my classpath with
non-classes.
Jake

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


IMPORTANT -

This email and any attachments are confidential and may be privileged in 
which case neither is intended to be waived. If you have received this 
message in error, please notify us and remove it from your system. It is 
your responsibility to check any attachments for viruses and defects 
before opening or sending them on. Where applicable, liability is limited 
by the Solicitors Scheme approved under the Professional Standards Act 
1994 (NSW). Minter Ellison collects personal information to provide and 
market our services. For more information about use, disclosure and 
access, see our privacy policy at www.minterellison.com.


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


Re: How do I do to change the properties file for log4jintoanother directory?

2003-11-06 Thread Jacob Kjome
It would help if you actually obtained your servlet context.  Right now, it 
is null.

ServletContext context = this.getServletContext()

Jake

At 10:47 AM 11/7/2003 +1100, you wrote:
Jake,

Thank you for your time. I have made the changes to the code as you
have suggested. It compiled without problem. However, it does not seems
to initiate the Log4j Tag Library. Have I missed out anything?
TJ


package com.log;
import org.apache.log4j.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Log4jInit extends HttpServlet {

public void init() {

   try {

   ServletContext context = null;
  URL url =
context.getResource(/WEB-INF/config/log4j.properties);
  BasicConfigurator.configure();
  BasicConfigurator.resetConfiguration();
  PropertyConfigurator.configure(url);
  } catch (MalformedURLException e) { e.printStackTrace();}

 Logger logger = Logger.getLogger(getClass());
 logger.info(Logging system initialised successfully);
 }

public void doGet(HttpServletRequest req, HttpServletResponse res) { }

}

 [EMAIL PROTECTED] 07/Nov/2003 10:21:59 am 

You need to look at my code closer.  context is a ServletContext.
You
can use it to access stuff anywhere in the webapp.
URL url = context.getResource(/WEB-INF/config/log4j.properties);
PropertyConfigurator.configure(url);
And, of course, you can also use the InputStream way if you want, but
the
URL way is a bit simpler.
One thing to note.  In my original code, I had forgotten to prefix
WEB-INF
with a /.  That is fixed in the code above.
Jake

At 09:59 AM 11/7/2003 +1100, you wrote:
Jake,

Putting the properties file under /web-inf/config is what I really
wanted to achieve, but I am not be able to make it work. I uses the
following to initialised the log4j package.



package com.log;

import org.apache.log4j.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class Log4jInit extends HttpServlet {


 public void init() {

   String servletContainer = getServletContext().getRealPath(/);

  // The exact path to the config file is in servlet mapping
  String file = getInitParameter(log4j);
  Logger logger = Logger.getLogger(getClass());

  // if the log4j-init is not set, then no point in trying
  if (file != null) {

  BasicConfigurator.configure();
  BasicConfigurator.resetConfiguration();
   PropertyConfigurator.configure(servletContainer+file);

  // Sent into to system.log
  logger.info(Logging system initialised successfully);

  }


 }

 public void doGet(HttpServletRequest req, HttpServletResponse
res)
{
 }

}

I uses the following for my database properties which I have no luck
in
getting it to read /web-inf/config too:

Properties Prop = new Properties();
try {

   InputStream configStream =
getClass().getResourceAsStream(/config/database.properties);
Prop.load(configStream);
   configStream.close();

} catch(IOException e) {

   System.out.println(Error: Cannot laod configuration file );
  }

Do you have a sample code that works? Thank you.


TJ



  [EMAIL PROTECTED] 06/Nov/2003 04:33:59 pm 
At 11:29 AM 11/5/2003 +1100, you wrote:
 I am using the Log Tag Library 1.0 from Jakarta Project.
 
 In the Installation document, it suggest that in order to
initialize
 Log4j automatically, the log4j.properties file will have to be
placed
in
 /WEB-INF/classes.
 
 How could I put the log4j.properties file in
/WEB-INF/classes/config
 directory? What do I have to do?
 
 Thank you.

If you are going to create a config dir, why not do it directly
under

WEB-INF rather than where classes are put?  You can load up an input
stream
using context.getResourceAsStream(WEB-INF/config/log4j.properties)
and
feed that info a Properties object, then send that into
PropertyConfigurator.configure(Properties) or load up a URL using
context.getResource(WEB-INF/config/log4j.properties) and send that
info
PropertyConfigurator.configure(URL).

Of course you can still do this even if you leave the config
directory
under WEB-INF/classes and use the same technique above.  Whatever
you

feel comfortable with.  I just like not cluttering my classpath with
non-classes.

Jake


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




IMPORTANT -

This email and any attachments are confidential and may be privileged
in
which case neither is intended to be waived. If you have received this
message in error, please notify us and remove it from your system. It
is
your responsibility to check any attachments for viruses and defects
before opening or sending them on. 

Re: logging to 2 destinations

2003-11-05 Thread Jacob Kjome
Use two separate file appenders, each pointing to its own file 
(eg  application.log and junit.log).  Then, I recommend that you define 
stuff in the root logger that you'd want for your most common logging 
activities;  probably the stuff going to application.log.  After that, 
define a logger for your junit tests.  Provide a reference to the junit 
appender, give it a level, and set additivity to false such as...

logger name=test.com.mycompany.mypackage additivity=falselevel 
value=debug/appender-ref ref=JUnitAppender//logger

That will end up acting, essentially, as the root logger for your junit 
tests and you will have entirely separated logging for application and 
junit classes.

Jake

At 08:00 PM 11/5/2003 -0600, you wrote:
1. how can the same log output be sent to two syslogs and a file?

2. I am running JUnit and my Application.  They both use log4j
Just running the application, all is logged in the
expected file.
When running tests, via JUnit, the JUnit test output
ends up in the Application logs.
How can this be separated to go to 2 diff files at
test time?
--
=
= Management is doing things right; leadership is doing the =
=   right things.- Peter Drucker=
=___=
= http://www.sun.com/service/sunps/jdc/javacenter.pdf   =
=  www.sun.com | www.javasoft.com | http://www.sun.com/sunone   =
=
-
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: How do I do to change the properties file for log4j into another directory?

2003-11-05 Thread Jacob Kjome
At 11:29 AM 11/5/2003 +1100, you wrote:
I am using the Log Tag Library 1.0 from Jakarta Project.

In the Installation document, it suggest that in order to initialize
Log4j automatically, the log4j.properties file will have to be placed in
/WEB-INF/classes.
How could I put the log4j.properties file in /WEB-INF/classes/config
directory? What do I have to do?
Thank you.
If you are going to create a config dir, why not do it directly under 
WEB-INF rather than where classes are put?  You can load up an input stream 
using context.getResourceAsStream(WEB-INF/config/log4j.properties) and 
feed that info a Properties object, then send that into 
PropertyConfigurator.configure(Properties) or load up a URL using 
context.getResource(WEB-INF/config/log4j.properties) and send that info 
PropertyConfigurator.configure(URL).

Of course you can still do this even if you leave the config directory 
under WEB-INF/classes and use the same technique above.  Whatever you 
feel comfortable with.  I just like not cluttering my classpath with 
non-classes.

Jake 

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


Re: Problem with logging separation between webapps and container

2003-11-05 Thread Jacob Kjome
I'd listen to Yoav here and keep your libs with each app.  However, I'm 
wondering why this isn't working for you.  What does your repository 
selector use to distinguish different logger repositories?  Are you sure it 
is actually being used by your webapp?  Note that commons-logging does some 
crazy stuff and could be interfering here.  commons-logging is almost 
reason enough to avoid using Struts, if you ask me (but you didn't, so I 
won't go on).

I've done plenty of testing where log4j.jar is in a global classloader 
which many webapps use and the repository selector stuff works like a charm 
to separate logging without having to put log4j.jar in each 
webapp.  However, I haven't much tested the case where those webapps share 
other libraries in a global classloader, simply because it isn't a very 
controllable environment for a webapp.  Maybe you can keep testing to make 
sure your repository selector is doing what you think it is doing but, in 
the end, I'd still follow Yoav's advice.

Jake

At 10:18 PM 11/5/2003 +0100, you wrote:
I'm using Resin Servlet Container.  I have developed librairies(jar files)
that are shared by many web applications, I have put my libraries jar in the
global classpath of the servlet container.  In those librairies, I'm using
log4j as logging mechanism with an xml configuration file.  Everything was
working fine.
The problem I have is when I used log4j with Struts in a webapp.  There is a
conflict, only the logging from the webapp works.  I understand that this is
a ClassLoader issue as described in the lo4j documentation.
I don't want to configure my libraries logging in each webapp but having
this kind of logging configured at the server level.
To fix the problem, I tried implementing a custom repository selector (taken
from the sandbox by Jacob Kjome) in my webapp so that both hierarchies
worked at the same time without any conflicts.  Even though it's supposed to
fix the problem, the webapp logging overwrites the server appenders.  I have
this warning:
log4j:WARN No appenders could be found for logger (DbController.class).
log4j:WARN Please initialize the log4j system properly.
log4j: Finalizing appender named [CONSOLE].
Any ideas on how to make this work?

thank in advance,

Stephanie St-Cyr
Software developer
AstraZeneca
here is my two xml configuration files:

the server one:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
 debug=true
   appender name=CONSOLE class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p
line %L -%m%n/
/layout
   /appender
   root
   level value=DEBUG/
   appender-ref ref=CONSOLE /
   /root
   !-- database logger --
   logger name=com.codestudio.util.PoolSkimmerThread  additivity=false
 level value=INFO /
 appender-ref ref=CONSOLE /
   /logger
   logger name=com.azrdm.util.DbControler  additivity=false
 level value=DEBUG /
 appender-ref ref=CONSOLE /
   /logger
/log4j:configuration

and the webapp:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
 debug=true
appender name=X class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%t %d{hh:mm:ss} %c %M %p
line %L -%m%n/
/layout
/appender
logger name=org.apache.commons.validator.ValidatorResources
additivity=false
level value=WARN/
appender-ref ref=X/
/logger
logger name=org.apache.struts.validator.ValidatorPlugIn
additivity=false
  level value=WARN/
  appender-ref ref=X/
/logger
logger name=org.apache.struts.util.PropertyMessageResources
additivity=false
  level value=WARN/
  appender-ref ref=X/
/logger
/log4j:configuration

-
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 warning: No appenders could be found

2003-11-01 Thread Jacob Kjome
You said that the jars are in a directory that is in the 
classpath.  However for the app to actually work, you must have had the 
jars themselves in the classpath.  Are you sure that you have the directory 
that contains the log4j.properties in the classpath?  If not, that is the 
problem.  I know that is what you said, but the way you said it was a bit 
ambiguous because of the way jars are added to the classpath; directly, not 
via being in a directory that is in the classpath.

Jake

At 09:38 AM 11/1/2003 -0800, you wrote:
Hello,

My application is using a jar file MyJar.jar that uses
log4j (I have the latest release of log4j).
I have put both MyJar.jar and log4j.jar in a directory
in my classpath. I have also put the file
log4j.properties into this same directory.
My log4j.properties file reads:

# Default Logging Configuration

log4j.rootLogger=INFO, stdout

#to increase logging level

#log4j.logger.org.dcm4cheri=DEBUG

#to decrease logging level

#log4j.logger.org.dcm4cheri=ERROR

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE}
%-5p %x - %m\n




When I run the program, I get the following warning:

log4j:WARN No appenders could be found for logger
(org.dcm4cheri.server.ServerImpl).
log4j:WARN Please initialize the log4j system
properly.
Any help would be greatly appreciated!

Aaron Boxer

__
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
-
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 vs. java.util.logging

2003-10-24 Thread Jacob Kjome
At 04:25 PM 10/24/2003 +0200, you wrote:
Some people may disagree but we have take the approach of using the
commons-logging API.
commons-logging has never been anything but a pain in the butt in every 
case I've seen it used.  The classloader issues are never-ending.

We have configured it to use log4j we appropriate.
If needed I can configure commons-logging to use JDK 1.4 logging.
Have you read this?
http://radio.weblogs.com/0122027/2003/08/15.html
Jake

-Original Message-
From: Matthias Petersen [mailto:[EMAIL PROTECTED]
Sent: 24 October, 2003 16:15
To: [EMAIL PROTECTED]
Subject: Log4J vs. java.util.logging
Hi,
I saw in the 1.4 JDK that there were new classes introduced concerning
logging, which
seems to be a base for Log4J. When I take a look at the class hierarchy of
Log4J, it is
not a subclass of those JDK logging classes (I think the reason is that
Log4J is older
than the 1.4 JDK...).
So, what will happen with Log4J in the future ? Will it be a subclass of the
Java 1.4
logging classes or will it go in a different direction ?
I think that the Log4J classes are much better than the 1.4 Java classes,
but what will
happen if those Java classes will become the standard for logging ? Or will
Log4J be a
part of the JDK somewhere in the future ?
Your answers are very important for me, because I have to decide if my
company is
using Log4J or if we need to enhance the 1.4 JDK logging classes.
Thanks
Matthias
--
Matthias Petersen
ms management systems gmbh
Krokamp 29
24539 Neumünster
Fon: +49. 4321. 9995-49
Fax: +49. 4321. 9995-41
E-Mail: [EMAIL PROTECTED]


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

For information about the Standard Bank group visit our web site 
www.standardbank.co.za
__

Disclaimer and confidentiality note
Everything in this e-mail and any attachments relating to the official 
business of Standard Bank Group Limited  is proprietary to the group.
It is confidential, legally privileged and protected by law.
Standard Bank does not own and endorse any other content. Views and 
opinions are those of the sender unless clearly stated as being that of 
the group.
The person addressed in the e-mail is the sole authorised recipient. 
Please notify the sender immediately if it has unintentionally reached you 
and do not read,
disclose or use the content in any way.
Standard Bank can not assure that the integrity of this communication has 
been maintained nor that it is free of errors, virus, interception or 
interference.
___


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


RE: Converting Log4j code to java.util.logging

2003-10-21 Thread Jacob Kjome
At 10:23 AM 10/21/2003 -0400, you wrote:
It's best not to get offended by Hani - if you go back and read the
archives, you'll find that every entry has the same kind of attitude, so
it's really a bit of a joke.  It is called The Bileblog, after all.
I think it isn't so much that he is being offensive, but annoying.  Seems 
like he likes to hear himself talk.  Makes the reading far less 
interesting.  Whether it is a joke or not, it is tiresome.

As for his point of Log4j being large, I tend to agree.  However, Log4j-1.3 
should remedy this since, I believe, it will be distributed without the log 
viewer apps in the core jar which should reduce the size significantly.  I 
still don't think it is of that much consequence.  Lots of libraries out 
there are moderately large.  However, hard disk and memory aren't exactly 
sparse these days.  There are many more important issues out there to deal 
with than the size of library dependencies.

Jake

-Original Message-
From: Tom Eugelink [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 2:37 AM
To: Log4J Users List
Subject: Re: Converting Log4j code to java.util.logging
It might be interesting, but even though I consider my english almost
readable, I'm getting offended by this guy attitude. Not the points he
is trying to make (in fact I agree with him on most), but the way he is
making it.
Sullivan, Sean C - MWT wrote:

 This blog is interesting:

 http://www.jroller.com/page/fate/20031018#java_util_logging_shoddiness



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


Re: Logging levels

2003-10-18 Thread Jacob Kjome
Thanks,

It was nice of you to put that comparison together.  However, did you have 
a particular point you were trying to make?  There have been lots of 
discussions on the list about how many/few levels are appropriate.  Have 
you perused those already?  Do you have an opinion in regard to what levels 
Log4j should or should not have?

Jake

At 02:32 PM 10/18/2003 -0700, you wrote:

Logging levels

Jakarta Log4j 1.2.8
===
 http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/Level.html

 class: org.apache.log4j.Level

 FATAL
 ERROR
 WARN
 INFO
 DEBUG
JBoss 3.2.2
===
 http://www.jboss.org/

 class:  org.jboss.logging.XLevel (extends org.apache.log4j.Level)

 FATAL
 ERROR
 WARN
 INFO
 DEBUG
 TRACE
BEA Weblogic Server 8.1
===
 http://edocs.bea.com/wls/docs81/javadocs/weblogic/logging/Severities.html

 class: weblogic.logging.Severities

 ALERT
 CRITICAL
 DEBUG
 EMERGENCY
 ERROR
 INFO
 NOTICE
 WARNING
 http://edocs.bea.com/wls/docs81/javadocs/weblogic/logging/WLLevel.html

 class: weblogic.logging.WLLevel (extends java.util.logging.Level)

 ALERT
 CRITICAL
 DEBUG
 EMERGENCY
 ERROR
 INFO
 NOTICE
 WARNING
Jakarta Commons Logging 1.0.3
=
 http://jakarta.apache.org/commons/logging/apidocs/index.html

 fatal
 error
 warn
 info
 debug
 trace
Apache Geronimo
===
 http://incubator.apache.org/projects/geronimo.html

 class: org.apache.geronimo.common.log.log4j.XLevel (extends
org.apache.log4j.Level)
 FATAL
 ERROR
 WARN
 INFO
 DEBUG
 TRACE
java.util.logging  (J2SE 1.4.2)
===
 http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/Level.html

 class: java.util.logging.Level

 SEVERE
 WARNING
 INFO
 CONFIG
 FINE
 FINER
 FINEST
Avalon LogKit 1.2
=
 http://avalon.apache.org/logkit/api/org/apache/log/Priority.html

 class: org.apache.log.Priority

 FATAL_ERROR
 ERROR
 WARN
 INFO
 DEBUG
Jakarta Slide 1.0.16

http://jakarta.apache.org/slide/javadoc/org/apache/slide/util/logger/Logger.
html
 interface: org.apache.slide.util.logger.Logger

 EMERGENCY
 CRITICAL
 ERROR
 WARNING
 INFO
 DEBUG
Acelet SuperLogging
===
 http://acelet.com/super/help/api/com/acelet/logging/Logging.html

 SEVERE
 WARNING
 INFO
 CONFIG
 FINE
 FINER
 FINEST
ObjectGuy Java Logging Framework

 http://www.theobjectguy.com/javalog/

 debug
 info
 status
 warning
 error
 critical
 fatal
-
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: App-server independent log4j logging

2003-10-17 Thread Jacob Kjome
At 09:04 AM 10/17/2003 -0400, you wrote:
Has anyone investigated the truthfulness of the following earlier post (by 
Jacob) on the subject:

snip
I just wanted to report something I read about the JBoss class loading 
scheme. You can view this information at...
http://umn.dl.sourceforge.net/sourceforge/jboss/ClassLoading.pdfhttp://umn.dl.sourceforge.net/sourceforge/jboss/ClassLoading.pdf

quote
WAR Loader. The WAR Loader is a servlet container specific ClassLoader 
that delegates to the Web
ENCLoader as its parent class loader. The default behavior is to load from 
its parent class loader and
then the war WEB-INF/{classes,lib} directories. If the servlet 2.3 class 
loading model is enabled it
will first load from the war WEB-INF/{classes,lib} and then the parent 
class loader.
quote

snip

This would seem to be intimately related.
Thanks for reminding us of that.  I had forgotten myself :-)  I don't play 
with JBoss much, so I have never tested the above statement.  Maybe someone 
can try it out and report back to the list?

Jake


At 12:40 AM 10/17/2003, Jacob Kjome wrote:

Try reading this and see if it helps out:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging
I'm not sure exactly the problem under JBoss, but they do seem to have 
the concept of a single classloader, which seems to cause grief for 
people who want to deploy their preferred versions of various libraries 
in WEB-INF/lib only to be overridden by the same library in JBoss 
itself.  Is there someone out there that can explain why JBoss' behavior 
is a good thing

Jake

At 03:42 PM 10/16/2003 -0400, you wrote:
I neglected to say that, if I move my logger and appender definitions into
JBoss's log4j.xml, I DO get the expected files. My question is: how can I
ADD new loggers and appenders from a separate config file to the hierarchy
that JBoss has already established?
-Original Message-
From: Doubleday, Dennis [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 3:11 PM
To: '[EMAIL PROTECTED]'
Subject: App-server independent log4j logging
My application needs to be deployable to both JBoss and Websphere (and
possibly Weblogic in future). I am trying to use log4j in my app, but not
having any success, even only with JBoss.
Here's the deal--I want to include my own log4j.jar and log4j.xml in my WAR
file. If the app server is using log4j itself, as JBoss does, my log4j.xml
should only extend the configuration set up by JBoss. I don't want to add my
Appenders to the JBoss log4j.xml, I want them in my WAR so it doesn't depend
on the JBoss environment.
Here is a snippet of what I am doing in my init servlet:

String prefix =  getServletContext().getRealPath(/);
String filePath = prefix + fileName;
System.out.println
   (Log4JConfigServlet - initializing log4j using file:  +
filePath);
try {
if (fileName.indexOf(xml) != -1) {
DOMConfigurator.configure(filePath);
} else {
PropertyConfigurator.configure(filePath);
}
   Logger log = Logger.getLogger(Log4JConfigServlet.class);
   if (log.isInfoEnabled()) {
   log.info(Log4j initilized.);
   }
} catch (Exception e) {

I see both the println and the initial INFO log message in the JBoss console
log, but the two FILE appenders don't seem to be getting created--I see
debug output from the initial JBoss configuration but there is no debug
output when my config file is processed. (The full file is at the end of the
message).
This approach worked in JBoss 3.0.6 but it mysteriously stopped when I
upgraded to JBoss 3.2.1.
Here's my log4j.xml:

log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
debug=true
  !-- = --
  !-- Preserve messages in a local file --
  !-- = --
  !-- A size based file rolling appender --
  appender name=FALCONFILE class=org.apache.log4j.RollingFileAppender
param name=File value=Falcon.log/
param name=Append value=false/
param name=MaxFileSize value=500KB/
param name=MaxBackupIndex value=20/
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%d %-5p [%c{1}.%M] %m%n/
/layout
  /appender
  appender name=FALCONHTML class=org.apache.log4j.RollingFileAppender
param name=File value=Falcon.html/
param name=Append value=false/
param name=MaxFileSize value=500KB/
param name=MaxBackupIndex value=20/
param name=threshold value=info/
layout class=org.apache.log4j.HTMLLayout/

  /appender

  appender name=FALCONCONSOLE class=org.apache.log4j.ConsoleAppender
param name=Target value=System.out/
layout class=org.apache.log4j.PatternLayout
  !-- The default pattern: Date Priority [Category] Message\n --
  param name=ConversionPattern value=%-5p [%c{1}] %m%n/
/layout
  /appender
  !-- Falcon base logger --
  logger name

Re: jboss-3.2.1_tomcat-4.1.24: problem with log4j

2003-10-13 Thread Jacob Kjome
Add log4.jar to common/lib of the Tomcat part of the bundle.  Not sure why 
it would work on one server, but not on another, though.

Jake

At 01:44 PM 10/13/2003 +0200, you wrote:

Hi!

I am trying to move the jboss-3.2.1_tomcat-4.1.24 container from one 
server to another. On the old server everythinhg is working perfect, but 
on the new one gets this error message:

12:59:19,703 ERROR [EmbeddedCatalinaService41] Starting failed
org.apache.commons.logging.LogConfigurationException: 
org.apache.commons.logging.LogConfigurationException: No suitable Log 
constructor [Ljava.lang.Class;@f1f051 for 
org.apache.commons.logging.impl.Log4JLogger

.

Caused by: org.apache.commons.logging.LogConfigurationException: No 
suitable Log constructor [Ljava.lang.Class;@f1f051 for 
org.apache.commons.logging.impl.Log4JLogger
   at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:432)
   at 
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
   ... 73 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger


I've seen this problem has been discussed for tomcat-4.1.24 already, but 
that did me no good... Any ideas? I've tried adding log4j.jar to the 
classpath, that did no good.

Any help is appreciated!

-Andreas Rodtwitt

_
Hotmail snakker ditt språk! 
http://www.hotmail.msn.com/cgi-bin/sbox?rru=dasp/lang.asp - Få Hotmail på 
norsk i dag

-
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 generated log file path

2003-10-07 Thread Jacob Kjome
That is where the JVM is started from and, hence, the location to which 
relatively specified files will be written.  What does your config file 
look like?  Have you specified a directory for output of your FileAppender?

Jake

At 04:40 AM 10/7/2003 -0700, you wrote:

Hi

I'm using log4j in my web application, which is deployed in Tomcat.

By default, log4j generates the log file user's directory i.e., 
C:\Documents and Settings\drathi\Start Menu\Programs\Apache Tomcat 4.1.

How can I make log4j to generate this log file at some other place?

thanks,

Naresh





-
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search


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


Re: log4j generated log file path

2003-10-07 Thread Jacob Kjome
At 06:56 AM 10/7/2003 -0700, you wrote:
log4j.appender.DISSLog.File=diss.log
That's the culprit.  Notice that you simply specified the log file 
name.  This is written out, as you've discovered, to a location relative to 
the directory where the JVM started.  Try using something like...

log4j.appender.DISSLog.File=C:\logs\diss.log

...or you can set a system property and reference that...

log4j.appender.DISSLog.File=${logfilelocation}/diss.log

I think that that works in property files?  I know it works in XML config 
files.

Jake

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


Re: log4j initialization in ejb jar modules

2003-10-06 Thread Jacob Kjome
At 11:18 AM 10/6/2003 +, you wrote:

Hi,

  I have a jar that contains some EJBs where I'm logging some
informations. In the present implementation I'm initializing and
shutting down log4j via a ServletContextListener. This approach
requires the deployment of a webapp (I had to declare the
listener and some other context parameters in the web.xml).
Instead of deploying only my .jar file I'm deploying a .war.
  Does anyone know if is there any other way to make this
initialization/shutdown?? (I want to deploy only the jar)
I don't know the answer, offhand, but you might look at the EJB spec and 
see what options it has for deployment.  Is there any functionality 
provided akin to the servlet spec's servlet context listener?  Maybe an EJB 
that loads at application startup?  I'm not aware of such a thing, but I 
don't do much EJB development right now (haven't much needed to).

Jake


Thanks in advance
Fabio

Get your free 15 Mb POP3 email @alexandria.cc
Click here - http://www.alexandria.cc/
-
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: Chaining

2003-10-03 Thread Jacob Kjome
At 04:03 AM 10/3/2003 -0500, you wrote:
What is NDC?
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/NDCvsMDC

Jake

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


Re: log4j xml configuration

2003-10-03 Thread Jacob Kjome
At 03:43 PM 10/3/2003 +, you wrote:
I am having problems getting log4j to configure from an XML file.
When I use the xml file shown below, i get the following warning in
java (1.4.1_02). Note: When I use a non-XML properties file it works
just fine.
log4j:WARN No appenders could be found for logger
(edu.jhuapl.latency.GNCSTlatencylog4j).
log4j:WARN Please initialize the log4j system properly.

Any ideas? Thanks in advance.
Try removing all appenders except for the console appender from the root 
logger and see it works.  Reducing the extraneous variables will help 
pinpoint the problem more efficiently.  Also, I assume you had put 
log4j.properties in the classpath and let log4j load it automatically.  I 
imagine you did the same for log4j.xml.  I think Log4j loads properties 
files preferentially to XML files (I could be wrong here).  Given that, it 
is possible that there were no other log4j.properties files in the 
classpath other than yours, but there may have been another log4j.xml file 
in the classpath that might be overriding yours.  That's just a shot in the 
dark as to why it worked with the properties file and not the XML file.

BTW, you should use level rather than priority.

Jake


Here is the xml file
-
?xml version=1.0 encoding=UTF-8?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;
   debug=true
!-- Console Appender --
appender name=stdout
class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern
value=%d{ISO8601} %-5p %C{2} [%t] (%F:%
L) - %m%n/
/layout
/appender
!-- Rolling file Appender --
appender name=R
class=org.apache.log4j.RollingFileAppender
param name=File value=log/gncst.log/
param name=MaxFileSize value=1000KB/
param name=MaxBackupIndex value=5/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern
value=%d{ISO8601} %-5p %C{2} [%t] (%F:%
L) - %m%n/
/layout
/appender
!-- LogFactor5 appender --
appender name=LF5_CLIENT
class=org.apache.log4j.lf5.LF5Appender
param name=MaxNumberOfRecords value=1000/
/appender
!-- JDBC Appender --
appender name=JDBC
class=org.apache.log4j.jdbcplus.JDBCAppender
param name=url
value=jdbc:oracle:thin:@tofu:1521:gncst/
param name=username value=gdba/
param name=password value=gdba/
param name=sql
   value=INSERT INTO latency_log
(LATENCY_IDENTIFIER, EVENT, COMPONENT, PROCESSING_LEVEL,
SECURITY_LEVEL, MESSAGE, TIMESTAMP) VALUES (@LATENCY_IDENTIFIER@,
@EVENT@, @COMPONENT@, @PROCESSING_LEVEL@, @SECURITY_LEVEL@,
@MESSAGE@, @TIMESTAMP@)/
param name=buffer value=1/
param name=commit value=Y/
layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern
value=%d{ISO8601} %-5p %C{2} [%t] (%F:%
L) - %m%n/
/layout
/appender
!-- Root debugger --
root
priority value=debug/
appender-ref ref=stdout/
appender-ref ref=R/
appender-ref ref=LF5_CLIENT/
appender-ref ref=JDBC/
/root
/log4j:configuration



-
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: Tomcat 4.1.24 and log4j -1.2.8.jar

2003-09-24 Thread Jacob Kjome
Tomcat uses commons-logging as well.  Try doing this.  Put a copy of 
log4j.jar in CATALINA_HOME/common/lib.  Also put a copy of log4j.jar in 
WEB-INF/lib of your webapp.  commons-logging uses some class loader 
trickery that flubs up much of the time.  I don't even want to know why it 
does this, I just want it to go away.  But since that isn't going to happen 
any time soon, we'll try to satisfy its quirks.

Oh, and you might want to put a copy of log4j.xml in 
CATALINA_HOME/common/classes with a root logger set to the level warn and 
a console appender.  That way, you won't get messages in Tomcat's logs 
saying that log4j failed to find its configuration.

Jake

At 07:40 AM 9/24/2003 -0700, you wrote:
Hi,

When I do that, struts 1.1 does not initialize with the following exception
mentioned in my earlier post:
However, Struts fails to initialize giving  an exception as follows:
javax.servlet.ServletException: Error instantiating servlet class
org.apache.struts.action.ActionServlet
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:91
2)
...
- Root Cause -
java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
 at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532)
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable
Log constructor [Ljava.lang.Class;@3a5794 for
org.apache.commons.logging.impl.Log4JLogger
 at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:432)
 at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525)
 ... 28 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
 at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
 at java.lang.Class.getConstructor0(Class.java:1762)
 at java.lang.Class.getConstructor(Class.java:1002)
 at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:429)
 ... 29 more
What am I missing?

Thanks!

- Original Message -
From: Shapira, Yoav [EMAIL PROTECTED]
To: Log4J Users List [EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 5:44 AM
Subject: RE: Tomcat 4.1.24 and log4j -1.2.8.jar


Howdy,

When I put my log4j -1.2.8 in the jak*/common/lib directory, Tomcat
refuses
to start
Not the right place.  Put it in the WEB-INF/lib directory of your
webapp.
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]


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


Re: Some questions on property settings

2003-09-16 Thread Jacob Kjome
At 09:11 AM 9/16/2003 +0200, you wrote:

Thank you Jack, for the hint.
Actually I knew about the book.
...but I thought it should be possible to set 2 or 3 simple property 
attributes without needing to acquire 200 pages of paper.
If I would think of buying books for all the  software I am just testing 
(and also using), I'd better grow my own trees
Fair enough and point taken.  Check out the other docs and the wiki...
http://jakarta.apache.org/log4j/docs/documentation.html
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages
Also, make sure to look in the Javadoc api docs since much of Log4j 
functionality is documented there.

Jake


Marc

Jacob Kjome wrote:

At 03:19 PM 9/15/2003 +0200, you wrote:

I am starting to use log4j since some weeks now and  I am very pleased 
with it.
The worsed thing about it is documentation  I guess.


I beg to differ...
https://www.qos.ch/shop/products/clm_t.jsp
Jake

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

*Marc Oesch*
tel: +49 6501 604404

fax: +49 6501 604403





[EMAIL PROTECTED]

Küferweg 18

D-54329 Konz

Germany






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


Re: log4j, JBoss, EJBs

2003-09-16 Thread Jacob Kjome
At 04:06 PM 9/16/2003 +0300, you wrote:
Now, what in the world does Cause: java.lang.IllegalArgumentException: 
Attempted to reset the LoggerFactory without possessing the guard. mean?
The guard is a simple object that protects against re-setting of the 
LoggerFactory by anyone but the one who set it first with a particular 
guard.  Basically, this would allow a container to set the LoggerFactory, 
but disallow applications running in the container from changing it.  If 
the container holds a handle on the guard object, then it alone can 
change the LoggerFactory.  If no one holds a handle on the guard object, 
then no one can change the LoggerFactory once it is set the first time.

The setting of the LoggerFactory is, obviously, being called multiple 
times.  Either avoid the multiple calls, catch and ignore the exception, or 
hold a handle to the guard object and re-set the LoggerFactory each time 
(probably not necessary or desired).

Jake 

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


RE: REPOST: RollingFileAppender does not create backups on WebSphere 5 onWindows

2003-09-15 Thread Jacob Kjome
At 07:28 PM 9/15/2003 +0300, you wrote:
Fortunately, I can use listeners, actually, I already have a context 
listener. But I'm not really sure how I can shut down log4j.
LogManager.shutdown();

Jake 

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


Re: [Fwd: tomcat 4.1.27 log4j 1.2.8 struts 1.1 = crash on logger.debug()]

2003-09-14 Thread Jacob Kjome
I'm still unable to comprehend why you have jboss-specific jars in Tomcat???

Also, the only thing that needs to go in the common/endorsed directory is 
the XML parser.  endorsed means that it overrides existing libraries in 
the JDK.  Only the xerces jar needs to go in common/endorsed because it 
contains endorsed libraries such as org.xml.*, javax.xml.*, and 
org.w3c.dom.*.  Make sure to remove xmlParserAPIs.jar and xercesImpl.jar if 
you put xerces-1.4.4.jar there.

Any other jars that are needed can go in either common/lib or 
shared/lib.  shared/lib makes libraries available to apps, but not the 
container itself.  common/lib is available to both the container and 
apps.  If the container doesn't need to see it, you probably shouldn't put 
it there.

Make sure another version of Log4j.jar wasn't added to JAVA_HOME/lib/ext or 
something like that.  The obvious problem is that another version of the 
log4j library is somewhere on the classpath.  It could be incorporated in 
any of the jars you have such as the jboss jars.  Make sure they don't have 
org.apache.log4j.* in them.

Oh there could be one other thing.  Since Tomcat-4.1.27 contains 
commons-logging in common/lib, you might need to move log4j.jar to 
common/lib and remove log4j.jar and commons-logging.jar from 
WEB-INF/lib.   If this was the problem, it would be the fault of 
commons-logging, not log4j.  It uses some funky class loading gimmicks that 
mess a lot of things up.

Jake

At 03:43 PM 9/13/2003 -0500, you wrote:
OK,

  I moved out several jar files but still get the same log4j error.

In WEB-INF/lib I now have.

ae.jar  (mine no log4j stuff in here I checked )
 ae_ejb.jar (mine no log4j stuff in here I checked )
 beandt.jar  (JBuilder log4j stuff in here)
 commons-beanutils.jar (struts1.1\contrib\struts-el\lib)
 commons-collections.jar (struts1.1\contrib\struts-el\lib)
 commons-digester.jar (struts1.1\contrib\struts-el\lib)
 commons-logging.jar (struts1.1\contrib\struts-el\lib)
 dbswing.jar  (JBuilder no log4j stuff in here)
 dx.jar   (JBuilder no log4j stuff in here)
 jstl.jar (struts1.1\contrib\struts-el\lib)
 log4j-1.2.8.jar (struts1.1\contrib\struts-el\lib)
 standard.jar (struts1.1\contrib\struts-el\lib)
 struts.jar (struts1.1\contrib\struts-el\lib)
 struts-el.jar   (struts1.1\contrib\struts-el\lib)
In CATALINA_HOME/common/endorsed I have

 jboss-client.jar  (Jboss 3.0.4)
 jboss-common.jar  (Jboss 3.0.4)
 jboss-j2ee.jar  (Jboss 3.0.4 also tried with out this file)
 jbosssx-client.jar  (Jboss 3.0.4)
 jnp-client.jar (Jboss 3.0.4)
 jnpserver.jar (Jboss 3.0.4)
 xerces.jar (1.4.4)
 commons-httpclient-2.0-rc1.jar
Thanks again,
Scott

 You can't put endorsed libraries under WEB-INF/lib.  This includes both
 JDK  endorsed libraries (such as javax.xml.*, org.w3c.dom.*, org.xml.*)
 and  libraries which Tomcat treats specially such as the servlet API and
 xml  parsers (Xerces).  Why do you need the j2ee jar there anyway?
 Tomcat  provides that for you.  And you shouldn't need many of the other
 jars you  have in there such as the jboss jars and the xerces1 jar (put
 that in  CATALINA_HOME/common/endorsed in place of the existing xerces
 jars).

 You are drowning in libraries.  You need to figure out what you actually
  need there and get rid of the rest.

 Jake

 At 02:19 PM 9/13/2003 -0500, you wrote:
Hey I think I found something that help!

When tomcat loads the jar files it prints the following message;

WebapClassLoader:
validateJarFileC:\java\jakarta-tomcat-4.1.27\webapps\ae_http\WEB-INF\li 
b\j2ee.jar
 - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
 javax/servlet/Servlet.class

I am digging to try to figure out why this is,

Thanks again,
Scott

  Sure JBuilder5,
  tomcat 4.1.27 log4j 1.2.8 struts 1.1
  Jdk 1.3.0_02
 
  Here is a list of the jar files in my WEB-INF/lib
 
  ae.jar  (mine no log4j stuff in here I checked )
  ae_ejb.jar (mine no log4j stuff in here I checked )
  beandt.jar  (JBuilder log4j stuff in here)
  commons-beanutils.jar (struts1.1\contrib\struts-el\lib)
  commons-collections.jar (struts1.1\contrib\struts-el\lib)
  commons-digester.jar (struts1.1\contrib\struts-el\lib)
  commons-logging.jar (struts1.1\contrib\struts-el\lib)
  dbswing.jar  (JBuilder no log4j stuff in here)
  dx.jar   (JBuilder no log4j stuff in here)
  j2ee.jar  (Sun 1.3.1)
  jboss-client.jar  (Jboss 3.0.4)
  jboss-common.jar  (Jboss 3.0.4)
  jboss-j2ee.jar  (Jboss 3.0.4)
  jbosssx-client.jar  (Jboss 3.0.4)
  jnp-client.jar (Jboss 3.0.4)
  jnpserver.jar (Jboss 3.0.4)
  jstl.jar (struts1.1\contrib\struts-el\lib)
  log4j-1.2.8.jar (struts1.1\contrib\struts-el\lib)
  standard.jar (struts1.1\contrib\struts-el\lib)
  struts.jar (struts1.1\contrib\struts-el\lib)
  struts-el.jar   (struts1.1\contrib\struts-el\lib)
  xerces.jar (1.4.4)
 
  The WEB-INF/classes directory has only classes in the com namespace.
 
Also I did a search for 

Re: [Fwd: tomcat 4.1.27 log4j 1.2.8 struts 1.1 = crash on logger.debug()]

2003-09-13 Thread Jacob Kjome
You can't put endorsed libraries under WEB-INF/lib.  This includes both JDK 
endorsed libraries (such as javax.xml.*, org.w3c.dom.*, org.xml.*) and 
libraries which Tomcat treats specially such as the servlet API and xml 
parsers (Xerces).  Why do you need the j2ee jar there anyway?  Tomcat 
provides that for you.  And you shouldn't need many of the other jars you 
have in there such as the jboss jars and the xerces1 jar (put that in 
CATALINA_HOME/common/endorsed in place of the existing xerces jars).

You are drowning in libraries.  You need to figure out what you actually 
need there and get rid of the rest.

Jake

At 02:19 PM 9/13/2003 -0500, you wrote:
Hey I think I found something that help!

When tomcat loads the jar files it prints the following message;

WebapClassLoader:
validateJarFileC:\java\jakarta-tomcat-4.1.27\webapps\ae_http\WEB-INF\lib\j2ee.jar
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
I am digging to try to figure out why this is,

Thanks again,
Scott
 Sure JBuilder5,
 tomcat 4.1.27 log4j 1.2.8 struts 1.1
 Jdk 1.3.0_02

 Here is a list of the jar files in my WEB-INF/lib

 ae.jar  (mine no log4j stuff in here I checked )
 ae_ejb.jar (mine no log4j stuff in here I checked )
 beandt.jar  (JBuilder log4j stuff in here)
 commons-beanutils.jar (struts1.1\contrib\struts-el\lib)
 commons-collections.jar (struts1.1\contrib\struts-el\lib)
 commons-digester.jar (struts1.1\contrib\struts-el\lib)
 commons-logging.jar (struts1.1\contrib\struts-el\lib)
 dbswing.jar  (JBuilder no log4j stuff in here)
 dx.jar   (JBuilder no log4j stuff in here)
 j2ee.jar  (Sun 1.3.1)
 jboss-client.jar  (Jboss 3.0.4)
 jboss-common.jar  (Jboss 3.0.4)
 jboss-j2ee.jar  (Jboss 3.0.4)
 jbosssx-client.jar  (Jboss 3.0.4)
 jnp-client.jar (Jboss 3.0.4)
 jnpserver.jar (Jboss 3.0.4)
 jstl.jar (struts1.1\contrib\struts-el\lib)
 log4j-1.2.8.jar (struts1.1\contrib\struts-el\lib)
 standard.jar (struts1.1\contrib\struts-el\lib)
 struts.jar (struts1.1\contrib\struts-el\lib)
 struts-el.jar   (struts1.1\contrib\struts-el\lib)
 xerces.jar (1.4.4)

 The WEB-INF/classes directory has only classes in the com namespace.

   Also I did a search for log4j in my jakarta-tomcat-4.1.27 directory
 and the only log4j that shows up is the one in WEB-INF/lib.

 When I run the thing from JBuilder the same jars are in my required
 libraries.

 The other weird thing that I should note is that the original stack
 trace that I mentioned was returned as html to my browser.  In the
 tomcat console nothing
 is printed.

 Thanks again,
 Scott





 There is something fishy about the stack trace. The following is from
 your  stack trace:
   at org.apache.log4j.Category.callAppenders(Category.java:190)

 If you look at the code of log4j 1.2.8, Category.java, line 190, you
 will  see that the line consists of a 'break' statement, not an
 invocation of  AppenderAttachableImpl.appendLoopOnAppenders, as the
 stack trace suggests.

 The evidence presented so far suggests that you are running two
 different  versions of log4j simultaneously.

 Can you tell more about your environment? JBuilder, JDK, JBoss, Tomcat
 versions?


 At 11:11 AM 9/13/2003 -0500, Scott Morgan wrote:
Hi Ceki,

  I am using the pre compiled versions from the Jakarta download
binaries site for all of the libraries.   After my .war files unwars
 the log4j-1.2.8.jar is in my lib directory with all the other jars,
 suns j2ee.jar (1.3.1), jboss-j2ee.jar (3.0.4), exc.  Also I mention
 that I have two j2ee.jar implementations in my path because it wasn't
 working without the sun j2ee.jar since that is necessary for the
log4j stuff and I am connecting to a jboss 3.0.4 server to get my data
 objects.

Thanks for responding!
Scott

 
  - Are you compiling log4j yourself using JBulder?
 
  - Do you have older versions of log4j lying around?
 
  At 02:57 PM 9/12/2003 -0500, you wrote:
 Hi,
 
 I am trying to get log4j to work in the following environment;
 tomcat 4.1.27 log4j 1.2.8 struts 1.1
 
 I have been able to get it working through invoking tomcat through
  JBuilder.  However when I run it with the startup.bat file I get a
 weird error. I have a log4j.xml file that works fine in my swing
 applet, and the JBuilder tomcat arena, logs messages , prints to the
 console nothing fancy.
 
 ?xml version=1.0 encoding=UTF-8 ?
 !DOCTYPE log4j:configuration SYSTEM log4j.dtd
 
 log4j:configuration
 xmlns:log4j=http://jakarta.apache.org/log4j/;
appender name=X class=org.apache.log4j.ConsoleAppender
  layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%d{hh:mm:ss} %c %M %t
 %p
 line
 %L -%m%n/
  /layout
/appender
logger name=com.adligo.systems.ae.ui.http additivity=false
  level value=DEBUG/
  appender-ref ref=X/
/logger
root
  priority value=WARN/
  appender-ref ref=X /
/root
 /log4j:configuration
 
 When I use this same file with struts and log4j, I am able to get
 the
 

Re: Elementary question

2003-09-07 Thread Jacob Kjome
Try this...

String configFileName = /com/common/logger.xml;

Always use forward slashes when dealing with class loader paths.  These are 
Java packages, not system directories (even though they look similar).

One other thing.  Where is the class you are using to load the logger.xml 
file?  Is it in the same package as logger.xml (actually, I just noticed it 
is the InitialContext class, so the answer is no, it isn't in the same 
package, but anyway...)?  If so, then just do..

String configFileName = logger.xml;

When using the getResource() method from the Class class, resources are 
relative to the class.  Notice in the first example that I overrode this 
the relative path by including a preceding forward slash which makes it 
look for the resource starting from the root package.  You can also use the 
ClassLoader.getResource() method and remove the preceding forward slash to 
do the same thing.

Jake

At 07:23 PM 9/7/2003 -0700, you wrote:
Hi,

I am trying to configure log4j for an app. Currently, I have deployed
it on Tomcat. My code snippet is -
..
String configFileName = com.common.logger.xml;
URL url = null;
Context ctx=null;
ctx = new InitialContext();
url = ctx.getClass().getResource(configFileName);
.
I put the xml file under a directory structure under classes in my
web-app. The issue is that the URL is null.
I also tried other options like making the string
\com\common\logger.xml and com\common\logger.xml
Another approach I tried was to get Thread.currentThread.getClassLoader
and read the URL from there, I get a vague null pointer exception and
zip exception.
I am sorry if this is a very elementary question, but I could not find
any solutions in the lists also.
Krishna.



-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software


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


Re: Elementary question

2003-09-07 Thread Jacob Kjome
InitialContext is probably loaded from a parent class loader and can't see 
the resource in your child class loader.  Why are you using InitialContext 
in this situation anyway?  Just use the class you are performing this 
from.  Let's call it MyClass

in a static context...
MyClass.class.getResource(configFileName);
in an object context...
this.getClass().getResource(configFileName);
There is no reason this shouldn't work.

Jake

At 08:06 PM 9/7/2003 -0700, you wrote:
Hi Jake,

thankou for the mail. I tried with forward slashes \, but the context 
does not seem to like it, I keep gettin the URL as null.

Jacob Kjome [EMAIL PROTECTED] wrote:

Try this...

String configFileName = /com/common/logger.xml;

Always use forward slashes when dealing with class loader paths. These are
Java packages, not system directories (even though they look similar).
One other thing. Where is the class you are using to load the logger.xml
file? Is it in the same package as logger.xml (actually, I just noticed it
is the InitialContext class, so the answer is no, it isn't in the same
package, but anyway...)? If so, then just do..
String configFileName = logger.xml;

When using the getResource() method from the Class class, resources are
relative to the class. Notice in the first example that I overrode this
the relative path by including a preceding forward slash which makes it
look for the resource starting from the root package. You can also use the
ClassLoader.getResource() method and remove the preceding forward slash to
do the same thing.
Jake

At 07:23 PM 9/7/2003 -0700, you wrote:
Hi,

I am trying to configure log4j for an app. Currently, I have deployed
it on Tomcat. My code snippet is -

..
String configFileName = com.common.logger.xml;
URL url = null;
Context ctx=null;
ctx = new InitialContext();
url = ctx.getClass().getResource(configFileName);
.

I put the xml file under a directory structure under classes in my
web-app. The issue is that the URL is null.

I also tried other options like making the string
\com\common\logger.xml and com\common\logger.xml

Another approach I tried was to get Thread.currentThread.getClassLoader
and read the URL from there, I get a vague null pointer exception and
zip exception.

I am sorry if this is a very elementary question, but I could not find
any solutions in the lists also.

Krishna.



-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software


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


Re: Log4j problem mixing 2 apps

2003-09-02 Thread Jacob Kjome
Use a custom repository selector.  There are two available in the 
log4j-sandbox project.  Read about them here:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Note that here, you might need to install a repository selector at app or 
server startup.  Not entirely sure what deployment of .ear files allow for 
(whether there is some application startup event that is analogous to a 
servlet context listener for servlets).

Also, in case you use JBoss, here is an informative doc on the class 
loading it uses...
http://umn.dl.sourceforge.net/sourceforge/jboss/ClassLoading.pdf

Jake

At 02:31 PM 9/2/2003 +0200, you wrote:
Hello,

I have two modules, which are using Log4J. The problem is, that the output 
from MOD1 is mixed with the output of MOD2 (MOD2 is also a standalone 
application). These two modules are added into an EAR-file. So I have also 
only one log4j.jar included.

What is the best way, to isolate the Log4J configuration of modules? Any 
ideas?

Juraj

-
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: Log file location

2003-08-31 Thread Jacob Kjome
I just wanted to report something I read about the JBoss class loading 
scheme.  You can view this information at...
http://umn.dl.sourceforge.net/sourceforge/jboss/ClassLoading.pdf

quote
WAR Loader. The WAR Loader is a servlet container specific ClassLoader that 
delegates to the Web
ENCLoader as its parent class loader. The default behavior is to load from 
its parent class loader and
then the war WEB-INF/{classes,lib} directories. If the servlet 2.3 class 
loading model is enabled it
will first load from the war WEB-INF/{classes,lib} and then the parent 
class loader.
quote

So, it looks as if JBoss supports being able to use the servlet-2.3 class 
loading model, but you have to enable it yourself (although I didn't see 
any information how exactly to do that).  There is lots of other 
interesting stuff in that document.  For those having problems logging in 
JBoss, this is a must read.

Jake

At 01:47 PM 8/29/2003 -0500, you wrote:
At 10:50 AM 8/29/2003 -0400, you wrote:
Re: Bug in jBoss

Alas. Actually/unfortunately the 2.3 (and 2.4 proposed final draft) 
Servlet spec only 'suggests' that the Containers ClassLoader give 
preference to the WebApp 
(http://www.jcp.org/aboutJava/communityprocess/final/jsr053/):

  SRV.9.7.2 Web Application Classloader

  ...It is recommended also that the application class loader be 
implemented so
  that classes and resources packaged within the WAR are loaded in 
preference to
  classes and resources residing in container-wide library JARs.

Note the use of the word 'recommended' and not 'required'
Thanks for pointing that out.  I guess if you hear something enough times, 
it becomes true, but I, obviously, should have gone back and read the 
actual spec on this point.  That is really problematic for trying to run 
apps which use different versions of libraries.  I wonder how JBoss users 
deal with that?

 FWIW, I have always ended up punting on this one and placing my log4j 
configuration into the jBoss server's log4j.xml file.  Perhaps jBoss 4.X 
has addressed this (I have not used it yet)?
I always end up using a repository selector and doing my own configuration 
from a servlet context listener and never count on default 
initialization.  What I'd like to find out is if JBoss includes its own 
repository selector an server startup.  It doesn't sound like it does at 
this point.  That is where the InitContextListener from logj4-sandbox 
comes in.  It attempts to install a repository selector if one is provided 
in the context-param's used by InitContextListener.

Hmm... I need to learn more about logging in JBoss.

Jake



At 02:05 AM 8/28/2003 -0500, Jacob Kjome wrote:


Well, if you your app is seeing jboss/lib/log4j.jar in preference to 
WEB-INF/lib/log4j.jar, then there is a bug in JBoss.  The Servlet spec 
states that (contrary to the normal Java2 classloading scheme) classes 
and libraries in WEB-INF/classes and WEB-INF/lib are checked first for 
classloading and if the classes are not found there, only then does it 
look to a higher classloader to attempt to load the classes.

I know JBoss has some concept of a single classloader across the whole 
server (I think that is what I read), but if it doesn't allow for a 
separate WebappClassLoader, then I think it is a spec compliance 
violation.  What does the JBoss group have to say about this?  Putting 
log4j.jar in WEB-INF/lib *should* provide a completely separate logging 
environment from the one JBoss uses.

Jake

At 12:09 PM 8/28/2003 +0530, you wrote:
Hi Jake,

Thanks for the information. I have gone through the stuff you've written.

Here's what I'm doing:
1. I placed log4j-1.2.8.jar in WEB-INF/lib
2. I placed log4j.properties in WEB-INF/classes
3. I deployed the application on JBoss 3.2.1
By default, JBoss has log4j.jar in jboss/lib which is in my classpath.
So, even my application class loader takes the classes from log4j.jar 
located in jboss/lib?

If I remove log4j.jar in jboss/lib, then I think I will not get server 
log of JBoss.

How to solve this issue? Please inform.

Sriram

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 11:00 AM
To: Log4J Users List
Subject: RE: Log file location


Hi Sriram,

Do you have log4j.jar in WEB-INF/lib?  If not, I'd expect default
initialization not to work.  Remember that the webapp class loader can see
parent class loaders, but the parents cannot see the webapp class loader,
hence your log4j.properties will definitely not be found.  If you are
trying to use log4j.jar in a parent class loader and want your own
configuration file to be used in your own logging space, then you will need
to use a repository selector.  See the log4j-sandbox for working
examples.  I wrote something up about this stuff here... 
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Jake

At 09:35 AM 8/28/2003 +0530, you wrote:
The properties file is not being read at all

I placed it in WEB

Re: ConfigureAndWatch with Webwork

2003-08-30 Thread Jacob Kjome
At 01:08 PM 8/29/2003 -0700, you wrote:
Hi

I've just started using Log4J and had a couple of doubts about how to set 
it up for a web-based application that uses Webwork.

1. Since Webwork configures log4j to use Configure, is there any way that 
can be changed to ConfigureAndWatch, without going into Webwork code.
Where do they do this?  Are you sure Webwork is not being configured via 
default initialization rather than specifically calling configure() in 
their core code?

2. Since there are multiple entry-points for the application, where should 
I specify the Configurator details (essentially, the ConfigureAndWatch 
method call)
Assuming they are using default initialization or use an initializer 
servlet or a servlet context listener, then you can avoid the configure() 
initialization by using your own initializer servlet or a servlet context 
listener.  See the log4j-sandbox for working code and/or read this...
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Also, as has been said here by me and by Ceki, you should not be using 
configureAndWatch() in a container because the watchdogs have no lifecycle 
to them.  Their threads cannot be stopped even when the application is 
stopped (but the container continues to run).  See:
 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22478

Jake

thanks a lot
Rajat.


-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software


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


RE: Log file location

2003-08-29 Thread Jacob Kjome
At 10:50 AM 8/29/2003 -0400, you wrote:
Re: Bug in jBoss

Alas. Actually/unfortunately the 2.3 (and 2.4 proposed final draft) 
Servlet spec only 'suggests' that the Containers ClassLoader give 
preference to the WebApp 
(http://www.jcp.org/aboutJava/communityprocess/final/jsr053/):

  SRV.9.7.2 Web Application Classloader

  ...It is recommended also that the application class loader be 
implemented so
  that classes and resources packaged within the WAR are loaded in 
preference to
  classes and resources residing in container-wide library JARs.

Note the use of the word 'recommended' and not 'required'
Thanks for pointing that out.  I guess if you hear something enough times, 
it becomes true, but I, obviously, should have gone back and read the 
actual spec on this point.  That is really problematic for trying to run 
apps which use different versions of libraries.  I wonder how JBoss users 
deal with that?

 FWIW, I have always ended up punting on this one and placing my log4j 
configuration into the jBoss server's log4j.xml file.  Perhaps jBoss 4.X 
has addressed this (I have not used it yet)?
I always end up using a repository selector and doing my own configuration 
from a servlet context listener and never count on default 
initialization.  What I'd like to find out is if JBoss includes its own 
repository selector an server startup.  It doesn't sound like it does at 
this point.  That is where the InitContextListener from logj4-sandbox comes 
in.  It attempts to install a repository selector if one is provided in the 
context-param's used by InitContextListener.

Hmm... I need to learn more about logging in JBoss.

Jake



At 02:05 AM 8/28/2003 -0500, Jacob Kjome wrote:


Well, if you your app is seeing jboss/lib/log4j.jar in preference to 
WEB-INF/lib/log4j.jar, then there is a bug in JBoss.  The Servlet spec 
states that (contrary to the normal Java2 classloading scheme) classes 
and libraries in WEB-INF/classes and WEB-INF/lib are checked first for 
classloading and if the classes are not found there, only then does it 
look to a higher classloader to attempt to load the classes.

I know JBoss has some concept of a single classloader across the whole 
server (I think that is what I read), but if it doesn't allow for a 
separate WebappClassLoader, then I think it is a spec compliance 
violation.  What does the JBoss group have to say about this?  Putting 
log4j.jar in WEB-INF/lib *should* provide a completely separate logging 
environment from the one JBoss uses.

Jake

At 12:09 PM 8/28/2003 +0530, you wrote:
Hi Jake,

Thanks for the information. I have gone through the stuff you've written.

Here's what I'm doing:
1. I placed log4j-1.2.8.jar in WEB-INF/lib
2. I placed log4j.properties in WEB-INF/classes
3. I deployed the application on JBoss 3.2.1
By default, JBoss has log4j.jar in jboss/lib which is in my classpath.
So, even my application class loader takes the classes from log4j.jar 
located in jboss/lib?

If I remove log4j.jar in jboss/lib, then I think I will not get server 
log of JBoss.

How to solve this issue? Please inform.

Sriram

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 11:00 AM
To: Log4J Users List
Subject: RE: Log file location


Hi Sriram,

Do you have log4j.jar in WEB-INF/lib?  If not, I'd expect default
initialization not to work.  Remember that the webapp class loader can see
parent class loaders, but the parents cannot see the webapp class loader,
hence your log4j.properties will definitely not be found.  If you are
trying to use log4j.jar in a parent class loader and want your own
configuration file to be used in your own logging space, then you will need
to use a repository selector.  See the log4j-sandbox for working
examples.  I wrote something up about this stuff here... 
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Jake

At 09:35 AM 8/28/2003 +0530, you wrote:
The properties file is not being read at all

I placed it in WEB-INF/classes.

Still it's not being read.

I am JBoss and JBoss contains log4j.jar by default and it has log4j.xml
in
default/conf folder.
Probably even my application is taking log4j.xml from that location by
default. I need to check that. Anyone who has implemented log4j for their
applications on JBoss, pl. suggest.


Sriram

-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 6:52 PM
To: Log4J Users List
Subject: Re: Log file location



Is the properties file being read at all?

At 06:25 PM 8/27/2003 +0530, sriram wrote:
 Hi,
 
 I am unable to set log file location. I searched the forum for old
 messages and found some. I tried the way it was mentioned in those
 messages, but still my problem is not solved.
 
 My log4j.properties file is as follows:
 
 log4j.rootCategory=WARN, dest1, R
 log4j.appender.dest1=org.apache.log4j.ConsoleAppender
 log4j.appender.dest1.layout

Re: config file reloading

2003-08-28 Thread Jacob Kjome
I used to use the configureAndWatch() method in my webapps, but I advise 
against it now.  The watchdog classes currently have no lifecycle 
control.  LogManager.shutdown() will *not* end the thread that the watchdog 
uses.  If you try to reload your servlet context, the thread will continue 
to reference the old webapp class loader.  Log4j-1.3. should have better 
options than configureAndWatch().  I would suggest not doing anything to 
the dtd or DOMConfigurator to provide special support for 
configureAndWatch().  It will probably be either deprecated or implemented 
differently later.

That said, if you still want to use configureAndWatch(), you can use the 
InitContextListener() from log4j-sandbox to provide information to your 
webapp as to where your configuration file is.  There are other options as 
well, but I'll let you read about those.  As for dealing with a non-servlet 
environment, this is actually less problematic since it probably is the 
only app running under the JVM, unlike a container environment where lots 
of apps and lots of class loaders are running.  I would just provide 
configuration option for your standalone app to be able to specify where 
the log4j.xml file exists.  Shouldn't be hard to write.  And you'll have to 
do initialization yourself instead of counting on default initialization.

Jake

At 03:48 PM 8/27/2003 -0700, you wrote:
Hello,

I was planning on using the FileWatchdog class (via 
DOMConfigurator) to cause my log4j.xml file to be reloaded whenever it is 
changed, avoiding having to bounce the webapp during debug.  My problem 
is that I rely on the default initialization mechanism in log4j to find 
the file, so I don't have the filename.  I'm currently looking at 
modifying the dtd to add a watch option so the DOMConfigurator can 
setup the watchdog during init.

Is there a better way to do this??  I'm building a package for 
use by our web-apps and standalone-apps, so I need something that works 
well in both environments.  Any thoughts??

--- regards ---
Larry
--
Larry Young
The Dalmatian Group
www.dalmatian.com
-
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: config file reloading

2003-08-28 Thread Jacob Kjome
Oh, and I forgot to mention setting the -Dlog4j.configuration system 
property which you can poll to find where log4j.xml exists.

Jake

At 06:09 PM 8/27/2003 -0500, you wrote:

I used to use the configureAndWatch() method in my webapps, but I advise 
against it now.  The watchdog classes currently have no lifecycle 
control.  LogManager.shutdown() will *not* end the thread that the 
watchdog uses.  If you try to reload your servlet context, the thread will 
continue to reference the old webapp class loader.  Log4j-1.3. should have 
better options than configureAndWatch().  I would suggest not doing 
anything to the dtd or DOMConfigurator to provide special support for 
configureAndWatch().  It will probably be either deprecated or implemented 
differently later.

That said, if you still want to use configureAndWatch(), you can use the 
InitContextListener() from log4j-sandbox to provide information to your 
webapp as to where your configuration file is.  There are other options as 
well, but I'll let you read about those.  As for dealing with a 
non-servlet environment, this is actually less problematic since it 
probably is the only app running under the JVM, unlike a container 
environment where lots of apps and lots of class loaders are running.  I 
would just provide configuration option for your standalone app to be able 
to specify where the log4j.xml file exists.  Shouldn't be hard to 
write.  And you'll have to do initialization yourself instead of counting 
on default initialization.

Jake

At 03:48 PM 8/27/2003 -0700, you wrote:
Hello,

I was planning on using the FileWatchdog class (via 
DOMConfigurator) to cause my log4j.xml file to be reloaded whenever it 
is changed, avoiding having to bounce the webapp during debug.  My 
problem is that I rely on the default initialization mechanism in log4j 
to find the file, so I don't have the filename.  I'm currently looking 
at modifying the dtd to add a watch option so the DOMConfigurator can 
setup the watchdog during init.

Is there a better way to do this??  I'm building a package for 
use by our web-apps and standalone-apps, so I need something that works 
well in both environments.  Any thoughts??

--- regards ---
Larry
--
Larry Young
The Dalmatian Group
www.dalmatian.com
-
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]


RE: Log file location

2003-08-28 Thread Jacob Kjome
Hi Sriram,

Do you have log4j.jar in WEB-INF/lib?  If not, I'd expect default 
initialization not to work.  Remember that the webapp class loader can see 
parent class loaders, but the parents cannot see the webapp class loader, 
hence your log4j.properties will definitely not be found.  If you are 
trying to use log4j.jar in a parent class loader and want your own 
configuration file to be used in your own logging space, then you will need 
to use a repository selector.  See the log4j-sandbox for working 
examples.  I wrote something up about this stuff here...
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Jake

At 09:35 AM 8/28/2003 +0530, you wrote:
The properties file is not being read at all

I placed it in WEB-INF/classes.

Still it's not being read.

I am JBoss and JBoss contains log4j.jar by default and it has log4j.xml in 
default/conf folder.
Probably even my application is taking log4j.xml from that location by 
default. I need to check that. Anyone who has implemented log4j for their 
applications on JBoss, pl. suggest.

Sriram

-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 6:52 PM
To: Log4J Users List
Subject: Re: Log file location


Is the properties file being read at all?

At 06:25 PM 8/27/2003 +0530, sriram wrote:
Hi,

I am unable to set log file location. I searched the forum for old
messages and found some. I tried the way it was mentioned in those
messages, but still my problem is not solved.

My log4j.properties file is as follows:

log4j.rootCategory=WARN, dest1, R
log4j.appender.dest1=org.apache.log4j.ConsoleAppender
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%-5p: %m%n

 appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p: %m%n
log4j.appender.R.File=d:/jboss/errors.log


I packaged  by application as .ear and deployed it on JBoss running on
Win
2000.

When I run the application, I can see the log messages on JBoss
console,
but these messages are not getting stored in the file I've specified
(d:/jboss/errors.log).

What could be the problem? In fact, initially I tried
${jboss.home}/errors.log, but it didn't work. So I thought of hard coding
the file location and tried it out. Still the same problem.

Can someone please suggest a solution?

Thanks
Sriram

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


RE: Log file location

2003-08-28 Thread Jacob Kjome
At 06:27 PM 8/28/2003 +0530, you wrote:
Ceki,

I'm trying the way you have mentioned at http://www.qos.ch/logging/sc.html
(using LoggerRepository).
In my java class, I have the following code:
(I'm using JNDIRS you've mentioned in the above URL)
private static final JNDIRS jndirs = new JNDIRS();
private static final LoggerRepository loggerRepository = 
jndirs.getLoggerRepository();
private static final Logger logger = 
loggerRepository.getLogger(MyApp.class.getName());
You don't need to do that if you are using a logger repository.  Just use 
LogManager.setLoggerRepostiory() and define your logger like normal...

private static final Logger logger = Logger.getLogger(MyApp.class.getName());

See info about using repository selectors plus 2 selectors which have 
already been written (mirrors, but somewhat modifies code in Ceki's 
article)
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Ceki mentioned JBoss plugins.  You could set up a plugin to install the 
repository selector at JBoss startup and you would be guaranteed to have a 
separate logging environment.  Otherwise, run the IniContextListener 
servlet context listener in the logj4-sandbox to set things up.

Jake


logger.warn(Just testing a log message with priority set to WARN);

My log4j.properties file is as follows:
 appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p: %m%n
log4j.appender.R.File=errors.log
Still I feel that my log4j.properties file not being read, because I can't 
see errors.log created anywhere. And there are no errors throws.

Any idea what could be the problem? Can you pl. suggest a solution?

Sriram





-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 12:58 PM
To: Log4J Users List
Subject: RE: Log file location


We should have a look at the jboss mailing lists. JBoss' class loader is
called UnifiedClassLoader. The last time I look at UnifiedClassLoaders
about a year ago, it seemed very smart. I'd have to look at the details again.
At 02:05 AM 8/28/2003 -0500, Jacob Kjome wrote:

Well, if you your app is seeing jboss/lib/log4j.jar in preference to
WEB-INF/lib/log4j.jar, then there is a bug in JBoss.  The Servlet spec
states that (contrary to the normal Java2 classloading scheme) classes and
libraries in WEB-INF/classes and WEB-INF/lib are checked first for
classloading and if the classes are not found there, only then does it
look to a higher classloader to attempt to load the classes.

I know JBoss has some concept of a single classloader across the whole
server (I think that is what I read), but if it doesn't allow for a
separate WebappClassLoader, then I think it is a spec compliance
violation.  What does the JBoss group have to say about this?  Putting
log4j.jar in WEB-INF/lib *should* provide a completely separate logging
environment from the one JBoss uses.

Jake

At 12:09 PM 8/28/2003 +0530, you wrote:
Hi Jake,

Thanks for the information. I have gone through the stuff you've
written.

Here's what I'm doing:
1. I placed log4j-1.2.8.jar in WEB-INF/lib
2. I placed log4j.properties in WEB-INF/classes
3. I deployed the application on JBoss 3.2.1

By default, JBoss has log4j.jar in jboss/lib which is in my classpath.
So, even my application class loader takes the classes from log4j.jar
located in jboss/lib?

If I remove log4j.jar in jboss/lib, then I think I will not get server
log of JBoss.

How to solve this issue? Please inform.

Sriram


-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 11:00 AM
To: Log4J Users List
Subject: RE: Log file location



Hi Sriram,

Do you have log4j.jar in WEB-INF/lib?  If not, I'd expect default
initialization not to work.  Remember that the webapp class loader can
see parent class loaders, but the parents cannot see the webapp class
loader, hence your log4j.properties will definitely not be found.  If
you are trying to use log4j.jar in a parent class loader and want your
own configuration file to be used in your own logging space, then you
will need to use a repository selector.  See the log4j-sandbox for
working examples.  I wrote something up about this stuff here...
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppCont
ainerLogging

Jake

At 09:35 AM 8/28/2003 +0530, you wrote:
 The properties file is not being read at all
 
 I placed it in WEB-INF/classes.
 
 Still it's not being read.
 
 I am JBoss and JBoss contains log4j.jar by default and it has
 log4j.xml in default/conf folder.
 Probably even my application is taking log4j.xml from that location by
 default. I need to check that. Anyone who has implemented log4j for their
 applications on JBoss, pl. suggest.
 
 
 Sriram
 
 -Original Message-
 From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 27, 2003 6:52

RE: Log file location

2003-08-28 Thread Jacob Kjome
At 08:09 PM 8/28/2003 +0530, you wrote:

I thought it would be a better idea to separate the application log with 
that of JBoss server log and so I am trying that out.

But I wonder is there any way in which I can configure the following using 
JBoss's log4j.xml:
- All server logs should be written to server.log
- All Myapplication logs should be written to myapplication.log

Basically log output should be directed to two files. Is this possible?

Please inform.
Of course.  Configure a separate appender for your own application logging.

Jake






-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 8:09 PM
To: Log4J Users List
Subject: RE: Log file location


Sriram,

We have not yet added the code to automatically read configuration files 
when a repository is first accessed.

However, nothing prevents you from configuring a repository in your
applications.
As for using and installing JNDIRS, JBoss has very cool ways for 
installing plugins. You might want to write a plugin that installs JNDIRS 
(JNDI Repository Selector) through org.apache.log4j.LogManager's 
setRepositorySelector() method.

All this might be somewhat complicated at the beginning. Why don't you 
just configure the log4j settings of JBoss? Wouldn't that be the easiest
option?

At 06:27 PM 8/28/2003 +0530, sriram wrote:
Ceki,

I'm trying the way you have mentioned at
http://www.qos.ch/logging/sc.html (using LoggerRepository).

In my java class, I have the following code:
(I'm using JNDIRS you've mentioned in the above URL)

private static final JNDIRS jndirs = new JNDIRS();
private static final LoggerRepository loggerRepository =
jndirs.getLoggerRepository();
private static final Logger logger =
loggerRepository.getLogger(MyApp.class.getName());


logger.warn(Just testing a log message with priority set to WARN);


My log4j.properties file is as follows:
 appender writes to a file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p: %m%n
log4j.appender.R.File=errors.log

Still I feel that my log4j.properties file not being read, because I
can't
see errors.log created anywhere. And there are no errors throws.

Any idea what could be the problem? Can you pl. suggest a solution?

Sriram






-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 12:58 PM
To: Log4J Users List
Subject: RE: Log file location



We should have a look at the jboss mailing lists. JBoss' class loader
is called UnifiedClassLoader. The last time I look at
UnifiedClassLoaders about a year ago, it seemed very smart. I'd have to
look at the details again.


At 02:05 AM 8/28/2003 -0500, Jacob Kjome wrote:

 Well, if you your app is seeing jboss/lib/log4j.jar in preference to
 WEB-INF/lib/log4j.jar, then there is a bug in JBoss.  The Servlet
 spec states that (contrary to the normal Java2 classloading scheme)
 classes and libraries in WEB-INF/classes and WEB-INF/lib are checked
 first for classloading and if the classes are not found there, only
 then does it look to a higher classloader to attempt to load the
 classes.
 
 I know JBoss has some concept of a single classloader across the
 whole server (I think that is what I read), but if it doesn't allow
 for a separate WebappClassLoader, then I think it is a spec
 compliance violation.  What does the JBoss group have to say about
 this?  Putting log4j.jar in WEB-INF/lib *should* provide a completely
 separate logging environment from the one JBoss uses.
 
 Jake
 
 At 12:09 PM 8/28/2003 +0530, you wrote:
 Hi Jake,
 
 Thanks for the information. I have gone through the stuff you've
 written.
 
 Here's what I'm doing:
 1. I placed log4j-1.2.8.jar in WEB-INF/lib
 2. I placed log4j.properties in WEB-INF/classes
 3. I deployed the application on JBoss 3.2.1
 
 By default, JBoss has log4j.jar in jboss/lib which is in my
 classpath. So, even my application class loader takes the classes
 from log4j.jar located in jboss/lib?
 
 If I remove log4j.jar in jboss/lib, then I think I will not get
 server log of JBoss.
 
 How to solve this issue? Please inform.
 
 Sriram
 
 
 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 28, 2003 11:00 AM
 To: Log4J Users List
 Subject: RE: Log file location
 
 
 
 Hi Sriram,
 
 Do you have log4j.jar in WEB-INF/lib?  If not, I'd expect default
 initialization not to work.  Remember that the webapp class loader
 can see parent class loaders, but the parents cannot see the webapp
 class loader, hence your log4j.properties will definitely not be
 found.  If you are trying to use log4j.jar in a parent class loader
 and want your own configuration file to be used in your own logging
 space, then you will need to use a repository selector.  See the
 log4j-sandbox for working examples.  I wrote something up about this
 stuff here...
 http

Re: config file reloading

2003-08-28 Thread Jacob Kjome
Unfortunately, I don't have much to say here.  I only ever added 
loggers.  A better approach is to use a runtime logger configurator.  There 
is one in the sandbox, but that only works on existing loggers.  There are 
other runtime configurators out there that can add/remove loggers and 
appenders.  All I can say is that configureAndWatch() has issues which 
you'll have to live with for now.

Mark Womack is/was working on a replacement for configureAndWatch() which 
will be much more flexible and workable (so he says).  You might want to 
get the skinny from him about this new functionality which will be 
available in Log4j-1.3 when it comes out.

Jake

At 08:58 AM 8/28/2003 -0700, you wrote:
Jake,

A quick question about your past use of configureAndWatch() ...

I noticed in Ciki's book that when loading a config file, only 
those parts of the existing configuration which are explicitly mentioned 
in the new config file are affected.  That makes sense if you are 
interested in configuration additivity, but if you are simply trying to 
maintain the configuration of the running system in-sync with the 
configuration file, then this would be a bad thing.  Not only that, but 
some loggers who share an appender may get effectively disabled if that 
appender is reconfigured and the logger is not explicitly in the updated 
config file.

But in looking through the configureAndWatch() path of 
execution, I don't see them attempting to completely cleanout the current 
configuration and replace it with the new one specified by the config 
file.  In this situation, I would think it was necessary to blow 
everything away and start again with the new config.

So, how did you deal with this when you were using this 
feature?  Did you have to ensure that loggers were never removed from the 
config file when it was updated??  Did you make some other mods to ensure 
consistency??  Any insights or experiences appreciated! Thanks.

--- regards ---
Larry
At 06:09 PM 8/27/03 -0500, you wrote:

I used to use the configureAndWatch() method in my webapps, but I advise 
against it now.  The watchdog classes currently have no lifecycle 
control.  LogManager.shutdown() will *not* end the thread that the 
watchdog uses.  If you try to reload your servlet context, the thread 
will continue to reference the old webapp class loader.  Log4j-1.3. 
should have better options than configureAndWatch().  I would suggest not 
doing anything to the dtd or DOMConfigurator to provide special support 
for configureAndWatch().  It will probably be either deprecated or 
implemented differently later.

That said, if you still want to use configureAndWatch(), you can use the 
InitContextListener() from log4j-sandbox to provide information to your 
webapp as to where your configuration file is.  There are other options 
as well, but I'll let you read about those.  As for dealing with a 
non-servlet environment, this is actually less problematic since it 
probably is the only app running under the JVM, unlike a container 
environment where lots of apps and lots of class loaders are running.  I 
would just provide configuration option for your standalone app to be 
able to specify where the log4j.xml file exists.  Shouldn't be hard to 
write.  And you'll have to do initialization yourself instead of counting 
on default initialization.

Jake
--
Larry Young
The Dalmatian Group
www.dalmatian.com
-
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: config file reloading

2003-08-28 Thread Jacob Kjome
At 06:16 PM 8/28/2003 +0200, you wrote:

Two short comments.

1) My name is Ceki not Ciki.
Sorry Ceki, typo.

2) You can use LogManager.resetConfiguration() to reset or clear the 
existing config before you read the new config file.
Ah, yes.  Never bothered with that since the configuration I do is totally 
separated from the rest of the code in the app and using a runtime utility 
for changing existing loggers is generally all I ever need.

Jake

HTH,

At 08:58 AM 8/28/2003 -0700, Larry Young wrote:
Jake,

A quick question about your past use of configureAndWatch() ...

I noticed in Ciki's book that when loading a config file, only 
those parts of the existing configuration which are explicitly mentioned 
in the new config file are affected.  That makes sense if you are 
interested in configuration additivity, but if you are simply trying 
to maintain the configuration of the running system in-sync with the 
configuration file, then this would be a bad thing.  Not only that, but 
some loggers who share an appender may get effectively disabled if that 
appender is reconfigured and the logger is not explicitly in the updated 
config file.

But in looking through the configureAndWatch() path of 
execution, I don't see them attempting to completely cleanout the 
current configuration and replace it with the new one specified by the 
config file.  In this situation, I would think it was necessary to blow 
everything away and start again with the new config.

So, how did you deal with this when you were using this 
feature?  Did you have to ensure that loggers were never removed from 
the config file when it was updated??  Did you make some other mods to 
ensure consistency??  Any insights or experiences appreciated! Thanks.

--- regards ---
Larry
At 06:09 PM 8/27/03 -0500, you wrote:

I used to use the configureAndWatch() method in my webapps, but I advise 
against it now.  The watchdog classes currently have no lifecycle 
control.  LogManager.shutdown() will *not* end the thread that the 
watchdog uses.  If you try to reload your servlet context, the thread 
will continue to reference the old webapp class loader.  Log4j-1.3. 
should have better options than configureAndWatch().  I would suggest 
not doing anything to the dtd or DOMConfigurator to provide special 
support for configureAndWatch().  It will probably be either deprecated 
or implemented differently later.

That said, if you still want to use configureAndWatch(), you can use the 
InitContextListener() from log4j-sandbox to provide information to your 
webapp as to where your configuration file is.  There are other options 
as well, but I'll let you read about those.  As for dealing with a 
non-servlet environment, this is actually less problematic since it 
probably is the only app running under the JVM, unlike a container 
environment where lots of apps and lots of class loaders are running.  I 
would just provide configuration option for your standalone app to be 
able to specify where the log4j.xml file exists.  Shouldn't be hard to 
write.  And you'll have to do initialization yourself instead of 
counting on default initialization.

Jake
--
Larry Young
The Dalmatian Group
www.dalmatian.com
-
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]


Re: org/apache/log4j/Category problem

2003-08-27 Thread Jacob Kjome
Hi Rishi,

Notice that you didn't get a ClassNotFoundException, but a 
NoClassDefFoundError.  They are very different.  The former means that it 
couldn't be found on the classpath where the latter means that at least one 
was found, but not the version it expected.  This is usually caused by 
different versions of the class viewable by the classloader.  Double check 
that you dont' have an old version of log4j.jar in JAVA_HOME/jre/lib/ext or 
something like that.

Also, how are you starting Tomcat?  Is it via the scripts or via an 
installed service?  The scripts eschew the system classpath altogether, but 
if you run as a service, you are at the mercy of whatever junk is on your 
system classpath (if you provided it to the service installer).  Of course, 
jre/lib/ext or jre/lib/endorsed are viewed as part of the JDK so watch what 
you put there.  It will almost always mess things up.

The easiest way to avoid collisions with various versions of log4j.jar 
running around is to put the jar in the WEB-INF/lib directory of your 
webapp.  And, as Paul mentioned in his reply, put log4j.xml or 
log4j.properties in WEB-INF/classes to allow log4j to use default 
initialization without you having to intervene with an init servlet.

Let us know how things go after you do that.

Jake

At 02:48 AM 8/27/2003 +0100, you wrote:
Hi all,

I have a servlet running in Tomcat, which I have setup to do logging via
log4j. However, I get the foll. error when I try to run my app:
java.lang.NoClassDefFoundError: org/apache/log4j/Category

I have the jog4j-1.2.8.jar file in my classpath.

I have also done:
PropertyConfigurator.configure(http://localhost:8080/examples/log4j.properties;);
where log4j.properties looks like:
log4j.rootLogger=INFO, d1
log4j.appender.d1=org.apache.log4j.FileAppender
log4j.appender.d1.layout=org.apache.log4j.SimpleLayout
Can anyone give me hints as to what's wrong?

thanks!
Rishi

Yahoo! India Promos: Win TVs, Bikes, DVD players  more!
Go to http://in.promos.yahoo.com
-
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: Question re: JBoss / Log4J / RepositorySelector / Web-apps

2003-08-24 Thread Jacob Kjome
At 09:00 PM 8/23/2003 -0400, you wrote:

Hi all, I'm trying to work with JBoss and Log4J, and have run
into a question that I can't seem to find the answer to. In the
course of trying to figure out how to specify per-application
Log4J configuration for web-apps running under JBoss,
I found this reference to the RepositorySelector mechanism:
https://www.qos.ch/logging/sc.html

What I don't know however is:

1. Does JBoss even support this mechanism?
Is JBoss written in Java?  Yes, I think it is.  Yep, it is
supported.  Repository selectors just need some unique characteristic that
can differentiate logger repositories.  There are a couple of different
obvious choices to use.  One is keying on different classloaders.  The
other, under a J2EE environment, is keying on a JNDI namespace.
Obviously,
both of these can be used in JBoss since it uses classloaders and is a
J2EE
container.
Sorry, I should have worded my question a little better. What I meant was
more like Does JBoss directly support this, via providing a relevant
RepositorySelector class, and does it set a RepositorySelector when it
initializes Log4J?  Or something along those lines.  Based on some
reading I'd done, I was under the impression that setting a
RepositorySelector
had to be done by the container, when operating in a container environment.
That is normally the caseand I'm not sure if JBoss has implemented this 
or not.  You'll probably find out more info on their list.  The way I have 
things set up in my repository selectors and my InitContextListener get 
around this limitation.  Of course, the caveat is that the first 
application to use a repostiory selector forces that selector on all other 
appsat least if those apps are using the same instance of Log4j (from a 
parent classloader instead of the webapp class loader).

To see a case where the container takes care of this, see the experimental 
Log4jHelper addon application for Tomcat-3.3.x...
http://cvs.apache.org/viewcvs/jakarta-tomcat/proposals/Log4jHelper/

If it is the case that the container does not have to set the
RespositorySelector
in order to use this approach, would that not mean however, that my client
code would
have to call setRepositorySelector()?
Yep, in your initialization.  See my InitContextListener for an example.


2. If so, how do I utilize it in my client code, to retrieve the app
specific
 Log4J instance?

My initial thought, based on a quick perusal of the javadoc gives me the
idea I'd need something like this:


public class ControllerServlet
{
   private static Logger logger;
   private ServletConfig config;

   public void init(ServletConfig config ) throws ServletException
   {
 this.config = config;
 LoggerRepository repos = LogManager.getLoggerRepository();
 logger = repos.getLogger( (ControllerServlet.class
).toString());

   }

   snip
}


is this anything close to correct?
It is actually easier than that.  Your logger code doesn't need to change
at all.  Just.  Once the logger repository selector is used in the
initialization of Log4j, you will be using a unique logger repository.
Aaah, that's the catch... do you have any idea how, in the JBoss
environment,
to ensure that the correct RepositorySelector class is used when Log4J is
initialized?  That seems to be the major thing I'm not understanding
here...
If JBoss initializes Log4J itself, wouldn't that prevent me from being
able to modify the selector? Or am I missing something badly here?
Yes, probably so, since you would need to have a handle on the original 
guard object that was used when setting the repository selector.  Without 
that, further calls to LogManager.setRepositorySelector() will fail to set 
your preferred selector.  But that isn't a problem if the existing selector 
works for you.  There isn't any reason it shouldn't.

3. assuming the above (or something similar) is used to retrieve the app
specific instance of Log4J,
is there anything special I need to do to tell Log4J where to find
the
app-specific log4j.xml?  Or is
simply putting log4j.xml under WEB-INF/classes sufficent?  Would I still
need to call DOMConfigurator.configure()?
If you use the default initialization mechanism, you will be logging in
the
default logger repository.  If you put both log4j.jar and your log4j.xml
in
the webapp's WEB-INF/lib and WEB-INF/classes, then you should be able to
use this mechanism since the servlet spec makes it so that the webapp
class
loader is checked first for classes and resources.  Only after that does
it
check parent classloader.  Note that this is converse to the normal Java2
class loader hierarchy.  If you put log4j.jar in a parent classloader
(outside of WEB-INF/lib), however, you will need to use a repository
selector to keep your logging separated from other apps.
Hmm... so are you saying that if I put log4j.jar in WEB-INF/lib, since the
class-loader for my web-app will look there first, it doesn't matter 

RE: Creating log files relative to the web applications root directory?

2003-08-14 Thread Jacob Kjome
Well, actually, under Tomcat, I wrote an InitContextListener which 
automagically figures out where the current webapp exists and sets a system 
property which is referenced in log4j.xml and,  viola!, the log files are 
placed in WEB-INF/logs of the current application no matter where it exists 
and without ever hardcoding the actual path.  Of course, this assumes you 
actually have write access to your webapp which is not guaranteed by the 
servlet spec.  In that case, your file appender will not work since it 
won't have a valid location to write to.

See the InitContextListener in the log4j-sandbox.  Instructions are in the 
javadoc.  See info and links here...
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Jake

At 08:35 PM 8/13/2003 +1000, you wrote:
G'day,

U, so basically then it is not possible to define a directory path in
the log4j.xml properties file so that log files are placed relative to the
web apps root directory?  Or for that matter relative to any known anchor
point like the server root directory?
A problem we have is that we deploy .war files by sending the package to the
server gods who then drop it into the webapps directory.  Alas we don't have
the rights to deploy directly to the server environment and tools like ANT
whilst are good at building a distributable archive they do not quite make
the grade when resolving tokens in a dynamic style of deployment.  Another
issue we have is that most of the development work is done on a Windows
based machine and the production servers are hosted on a flavor of Unix.
Hard coding a directory path like C:\..\ may work when doing the dev work
under Windows but just don't kind of cut it on a Unix file system when it
comes time to deployment.
BTW, the last time I looked me was male so I'll opt out for king!

AB

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Monday, 11 August 2003 11:14 PM
To: Log4J Users List
Subject: RE: Creating log files relative to the web applications root
directory?


Howdy,
I suppose Adrian could be a woman's name as well, so you're right ;)
AmendedVersion
But if you're the server admin, you're king (or queen) ;) /AmendedVersion
Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: Caroline Wood [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 9:13 AM
To: 'Log4J Users List'
Subject: RE: Creating log files relative to the web applications root
directory?

or Queen! lol ;)

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: 11 August 2003 14:05
To: Log4J Users List; [EMAIL PROTECTED]
Subject: RE: Creating log files relative to the web applications root
directory?



Howdy,
What I've seen done to achieve this is have my ant deployment script
fill the value when copying log4j.xml over.  So in log4j.xml, you'd
have

param name=File value=@logFilePath@ /

And in your ant script, you set filtering=true when copying
log4j.xml,
and replac the logFilePath token with the actual (absolute) path.

As an aside, note that the servlet container is not required to give
you
write access under your webapp's root.  In fact, many server admins
dislike this, as they prefer a centralized log location for their
systems.  But if you're the server admin, you're king ;)

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Adrian Beech [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 6:42 AM
To: 'Log4J Users List'
Subject: Creating log files relative to the web applications root
directory?

G'day,

Is it possible to specify a log filename in the XML log4j properties
file
so
that it is relative to the web applications root directory?

I have the following in a log4j.xml file located in web-inf/classes
with
the
log4j jar in the web-inf/lib directory.  Logging seems to be fine
except
the
rascal.log file is being created in the Tomcat application directory
under C:\Program Files\ and not in the C:\Tomcat 4.1\webapps\...
Directory
tree.
I'd prefer to have the log files in something like
../webapps/application/logs/logfilename.  Is this possible?

BTW, took a while to find the rascal.log file!!!

--[log4j.xml]-
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd

log4j:configuration

appender name=rf class=org.apache.log4j.RollingFileAppender
param name=file value=rascal.log/
param name=maxBackupIndex value=2/
param name=maxFileSize value=250KB/

layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%d{dd/MM/
HH:mm:ss}
%-5p (%t) %l - %m%n/
/layout
/appender

root
priority value=debug /
appender-ref ref=rf/
/root

/log4j:configuration
--[End Of File]---

I'm using Tomcat 4.1.24 on a Win XP and 2k box for development and
Tomcat
4.1.24 on a Unix box as the 

RE: how do i get Log4j in Tomcat environment?

2003-08-14 Thread Jacob Kjome
At 12:24 PM 8/7/2003 -0400, you wrote:
Jake,

Thanks for your thoughts.

I do have the log4j.jar file in the CATALINA_HOME/common/lib and the
WEB-INF/classes as well.
I assume you meant WEB-INF/lib, not WEB-INF/classes.  The latter is the 
place for log4j.xml while the former is the place for log4j.jar.

I am not getting any logging either.  The application is supposed to write
to a file and does not.
I'd have to verify that you have things set up right by looking at your 
log4j.xml file.

The problem appears to be that log4j is not starting due to the before
mentioned error (i.e. the appender missing).
No, that is a totally separate problem.  If you actually do have log4j.jar 
in WEB-INF/lib, then your application logging environment is completely and 
utterly separated from the one Tomcat is using.  Since there is no 
interaction, the error you see can't be causing the error unless you have 
other libraries which are (improperly) configuring log4j without your 
realizing it and, thus, overriding your configuration.  Do you use 
commons-logging or log4j directly?  What other libraries do you have in 
your webapp?

I also have the application writing to the console just so that I can see if
log4j is initializing upon startup.
You probably won't see default initialization unless you have debug=true 
in log4j.xml.  Try that.  Try also setting the root logger to a level of 
debug so that you can be assured that your classes are actually debugging.

Jake

Let me know if you have any additional thoughts.

Sincerely,

Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 11:38 AM
To: Log4J Users List
I see that error in Tomcat5 as well.  I assume you have log4j.jar in
CATALINA_HOME/common/lib?  Did you also add log4j.jar to WEB-INF/lib of
your application?  If not, do that and make sure your log4j.xml is in
WEB-INF/classes.  Everything should work fine for you.  The error is
inconsequential.  When commns-logging (which Tomcat uses) finds log4j.jar,
it uses it but there seems to be something wrong with the way they are
configuring it.  It shouldn't affect your application in the least.  Just
ignore the message.  Having log4j.jar in WEB-INF/lib gives you a completely
separate logging environment than that of the server.
BTW, are you not getting any logging from your application?  You should be
if you have things configured correctly as I've described above.
Jake

At 09:57 AM 8/7/2003 -0400, you wrote:

I am getting a startup error now on Log4J that is hopefully leading me to a
solution.  The error is:



Log4j: WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).  Please initialize the log4j
system properly.



I am currently running Tomcat 4.1.27 on XP-Pro.  I checked the log4j.xml
file and it includes the necessary appenders.  Does anyone know what may be
causing this error.



Thanks.



Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 2:58 PM
To: Log4J Users List


What exactly is the current problem you are having?  Just add log4j.jar to
WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you
are ready to go.  There are a couple of other options that are more
advanced, but this should get you going for now.

Jake

At 06:39 PM 8/6/2003 +0100, you wrote:
 Hi,
 Trying to use log4j in Tomcat environment. Seen loads of messages on
 this but haven't got
 Much useful stuff from them. Could someone direct me to an appropriate
 resource.
 Thanks
 KB


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



The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or
disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.


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


The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

Re: how do i get Log4j in Tomcat environment?

2003-08-14 Thread Jacob Kjome
What exactly is the current problem you are having?  Just add log4j.jar to 
WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you 
are ready to go.  There are a couple of other options that are more 
advanced, but this should get you going for now.

Jake

At 06:39 PM 8/6/2003 +0100, you wrote:
Hi,
Trying to use log4j in Tomcat environment. Seen loads of messages on
this but haven't got
Much useful stuff from them. Could someone direct me to an appropriate
resource.
Thanks
KB


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


RE: how do i get Log4j in Tomcat environment?

2003-08-14 Thread Jacob Kjome
Looks like that didn't make it either.  Not sure why?  You can send it 
directly to me.  Just grab my email from the mail headers.  Or you can just 
copy and paste it directly into the email rather than have it as an 
attachment.  That might be better so others can see it as well.

Jake

At 03:20 PM 8/7/2003 -0400, you wrote:
Sorry about that.

Here you go.

Thanks again.



-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 3:17 PM
To: Log4J Users List
If you want to attach something to the list, put it in a zip file first and
attach that.  Other attachments are rejected.
Jake

At 02:20 PM 8/7/2003 -0400, you wrote:
Jake,

Here is a copy of my log4j.xml file.  Let me know if you see anything
unusual or that may be contributing to my problems.

I did mean that my log4j.jar file is in the WEB_INF/lib directory.

Everything is where is belongs.

Thanks again.

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 12:50 PM
To: Log4J Users List

At 12:24 PM 8/7/2003 -0400, you wrote:
 Jake,
 
 Thanks for your thoughts.
 
 I do have the log4j.jar file in the CATALINA_HOME/common/lib and the
 WEB-INF/classes as well.

I assume you meant WEB-INF/lib, not WEB-INF/classes.  The latter is the
place for log4j.xml while the former is the place for log4j.jar.

 I am not getting any logging either.  The application is supposed to
write
 to a file and does not.

I'd have to verify that you have things set up right by looking at your
log4j.xml file.

 The problem appears to be that log4j is not starting due to the before
 mentioned error (i.e. the appender missing).

No, that is a totally separate problem.  If you actually do have log4j.jar
in WEB-INF/lib, then your application logging environment is completely and
utterly separated from the one Tomcat is using.  Since there is no
interaction, the error you see can't be causing the error unless you have
other libraries which are (improperly) configuring log4j without your
realizing it and, thus, overriding your configuration.  Do you use
commons-logging or log4j directly?  What other libraries do you have in
your webapp?

 I also have the application writing to the console just so that I can see
if
 log4j is initializing upon startup.

You probably won't see default initialization unless you have debug=true
in log4j.xml.  Try that.  Try also setting the root logger to a level of
debug so that you can be assured that your classes are actually debugging.

Jake

 Let me know if you have any additional thoughts.
 
 Sincerely,
 
 Tim
 
 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 07, 2003 11:38 AM
 To: Log4J Users List
 
 
 I see that error in Tomcat5 as well.  I assume you have log4j.jar in
 CATALINA_HOME/common/lib?  Did you also add log4j.jar to WEB-INF/lib of
 your application?  If not, do that and make sure your log4j.xml is in
 WEB-INF/classes.  Everything should work fine for you.  The error is
 inconsequential.  When commns-logging (which Tomcat uses) finds
log4j.jar,
 it uses it but there seems to be something wrong with the way they are
 configuring it.  It shouldn't affect your application in the least.  Just
 ignore the message.  Having log4j.jar in WEB-INF/lib gives you a
completely
 separate logging environment than that of the server.
 
 BTW, are you not getting any logging from your application?  You should
be
 if you have things configured correctly as I've described above.
 
 Jake
 
 At 09:57 AM 8/7/2003 -0400, you wrote:
 
 
  I am getting a startup error now on Log4J that is hopefully leading me
to
a
  solution.  The error is:
  
  
  
  Log4j: WARN No appenders could be found for logger
  (org.apache.commons.digester.Digester.sax).  Please initialize the
log4j
  system properly.
  
  
  
  I am currently running Tomcat 4.1.27 on XP-Pro.  I checked the
log4j.xml
  file and it includes the necessary appenders.  Does anyone know what
may
be
  causing this error.
  
  
  
  Thanks.
  
  
  
  Tim
  
  -Original Message-
  From: Jacob Kjome [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, August 06, 2003 2:58 PM
  To: Log4J Users List
  
  
  What exactly is the current problem you are having?  Just add log4j.jar
to
  WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and
you
  are ready to go.  There are a couple of other options that are more
  advanced, but this should get you going for now.
  
  Jake
  
  At 06:39 PM 8/6/2003 +0100, you wrote:
   Hi,
   Trying to use log4j in Tomcat environment. Seen loads of messages on
   this but haven't got
   Much useful stuff from them. Could someone direct me to an
appropriate
   resource.
   Thanks
   KB
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  The contents of this e-mail are intended for the named

Re: Urgent... Log 4j 1.2.7 issue...

2003-08-14 Thread Jacob Kjome
Not sure what the issue is, but why did you upgrade to 1.2.7?  1.2.8 is the 
latest and recommeded release.

Jake

At 11:04 AM 8/14/2003 -0700, you wrote:
Hi All

I was able to run log4j 1.1.3 version in my environment without any
problems. Now when I updated my log4j to ver 1.2.7
and I boot my weblogic server I get the following error,

log4j:WARN No appenders could be found for logger
(ABC_FILE_1_0.Configuration).
log4j:WARN Please initialize the log4j system properly.
log4j:ERROR Attempted to append to closed appender named [FileAppender].
log4j:ERROR Attempted to append to closed appender named [ConsoleAppender].
Can you let me know what the problem could be?

I know it is related to some configuration issue. Does it have to do with
the fact that in 1.2.7 when we boot the
server we have to mandatory mention the log4j:file location as -D option?
Thanks
Mayur.
-
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: Newbie how to place logfile under tomcat logs

2003-08-14 Thread Jacob Kjome
Just use default initialization or use the InitContextListener that I 
created in the log4j-sandbox project..

http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Jake

At 03:48 PM 8/12/2003 +0100, you wrote:
yeah, I'm using ant but I dont like the fact that it is hard-coded.
 I think I'll use the properties file option, we have a properties file 
already I'll just add the log4j properties to that. I don't suppose you 
know how to load the properites file when it is in a JAR? because it says 
in the log4j FAQ the log4j classes and the properties file are not 
within the scope of the same classloader.So, if you're having 
problems, try loading the class or resource yourself. 
 what i've done already is:

 Properties p = new Properties();
 FileInputStream fis;
try
{
fis = new FileInputStream(com.foo.bar.message.properties);
p.load(fis);
}
catch (Throwable t)
{
t.printStackTrace();
}
PropertyConfigurator.configure(p);

 but its not picking up our file in the JAR

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 2:42 PM
To: Log4J Users List
Subject: RE: Newbie how to place logfile under tomcat logs


Howdy,

 Thanks, thats a help but because of the setup of our application, I
cant
use the first two options, and I'd rather not define another properties
file just to store ${CATALINA_HOME}/logs/logs.txt. Is there any way I
can
do it programatically? What are the other options?
No.  It would be against the spirit, if not the letter, or the servlet
specification for a servlet to be able to find out such details about
its container.  Even the approaches I showed before weren't that
portable.  This is like those perennial how can I find out what port
the server is running on in my servlet's init() method? (You can't with
certainty/portability).
Other options include adding a JNDI entry for your log file path into
tomcat's server.xml and then doing a JNDI lookup in your servlet's init
method, or mangling your log4j configuration together with tomcat's
commons-logging configuration.  The latter is just cruising for a
bruising, and the former is too container-specific (requires modifying
server.xml) for my preferences, so I didn't include them before.
Typically the Ant option is the one I like best, but I guess you don't
use Any to deploy/package your application?
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]


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


RE: New issue on Log4J initialization

2003-08-14 Thread Jacob Kjome
What version of Tomcat are you using?  And is it a clean install?  That is, 
a stock install with nothing else added to it.

Jake

At 02:10 PM 8/11/2003 -0400, you wrote:
Jake,

Before I go on I want to thank you for all your help and patience.

I decided to test something out and totally removed my application and all
instances of our log4j-1.2.8 jar file.
Guess what happens?

I still get the error:

Log4j: WARN No appenders could be found for logger
org.apache.commons.digester.Digester.sax).  Please initialize the log4j
system properly.
What are your thoughts about this?

Thanks again.

Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 10:45 AM
To: Log4J Users List
At 09:25 AM 8/11/2003 -0400, you wrote:
Jake,

Having done as you said I am now getting a log file generated
Glad you got things going.  What do you think was the difference?  Can you
pinpoint the one change that made things start working?  It would be good
to know for future users having the same or similar problems.
, although I
still get the original error message from Tomcat:

Log4j: WARN No appenders could be found for logger
org.apache.commons.digester.Digester.sax).  Please initialize the log4j
system properly.

Any way to get that message to stop displaying?
Did you put a copy of log4j.jar back into common/lib?  That error is coming
from commons-logging finding Log4j and using it in preference to j2sdk1.4.x
logging, but if Log4j doesn't, then, find its configuration, you will get
that error.  Note that commons-logging does a bunch of classloading
trickery to find and load external logging packages.  It is entirely
possible that it might be using the context class loader to find Log4j,
thus being able to bypass the normal Java2 classloader hierarchy (where
only classloader higher in the hierarchy are visible).  However, I just
tested having log4j.jar in my WEB-INF/lib and not in common/lib and
commons-logging in common/lib couldn't see it (and, therefore, didn't get
the Log4j error), so it is most likely that you have log4j.jar in
common/lib (or shared/lib) or some other place where commons-logging in
Tomcat can see log4j.jar.  Remove Log4j.jar and you won't see that
erroror, I suppose, you could add log4j.xml or log4j.properties to
common/classes and all would be well.
Jake

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 2:05 AM
To: Log4J Users List

Hi Timothy,

This is why, when possible, I install apps manually by simply unzipping
them to a directory rather than running some fancy install which I have no
control over.  I do this with Tomcat.  I suppose this isn't possible with
current versions of Websphere, but they really shouldn't be modifying your
classpath anyway.  I'd send them a complaint about this so that they stop
this practice in the future.  Their batch scripts should set everything up
dynamically rather than modify the system CLASSPATH variable.

Anyway, you can achieve this yourself by opening a command prompt and
doing:
set CLASSPATH .

Now run Tomcat from there (although the default scripts should ignore the
classpath anyway, now that I think about it).

Anyway, try that out.  If that doesn't help, maybe if you have a sample
application you can send to me, I can test it out myself to see if I get
logging or not.  Some source code would also be good so I know where to
expect logging statements to come from.

Jake

At 01:27 PM 8/8/2003 -0400, you wrote:
 Keith,
 
 The problem I have with removing all that stuff is that 90% of it was put
 there by applications.  Should I remove parts of it anyway?  I guess
that's
 where my confusion is since (as I said) most of these variables were
entered
 by the installation of the applications themselves.
 
 Thanks for your thoughts Keith!
 
 -Original Message-
 From: Keith Hatton [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 08, 2003 12:18 PM
 To: Log4J Users List
 
 single period = . = class files etc. based on this directory only.
 
 It's just that the CLASSPATH environment variable often does more harm
than
 good.
 If you use java -cp something then the CLASSPATH is ignored, and often
 scripts that start Java apps will do just that. But then again, sometimes
 they add your CLASSPATH to theirs. That's when the trouble starts ...
 
 So basically, Jake's advice is, remove your CLASSPATH environment
variable
 if at all possible. Certainly that sounds like way too much junk in
there.
 
 Hope this helps
 Keith
 
 
 -Original Message-
 From: Farrell, Timothy [mailto:[EMAIL PROTECTED]
 Sent: 08 August 2003 17:00
 To: Log4J Users List
 Subject: RE: New issue on Log4J initialization
 
 
 Can you (or someone)explain your first statement (I'd change your
classpath
 to be no more than a single period)?
 
 I have both installed on my machine however, I only run one at a time
 depending on what I am working on.
 
 My app does not use struts or anything else

RE: New issue on Log4J initialization

2003-08-14 Thread Jacob Kjome
Hi Timothy,

This is why, when possible, I install apps manually by simply unzipping 
them to a directory rather than running some fancy install which I have no 
control over.  I do this with Tomcat.  I suppose this isn't possible with 
current versions of Websphere, but they really shouldn't be modifying your 
classpath anyway.  I'd send them a complaint about this so that they stop 
this practice in the future.  Their batch scripts should set everything up 
dynamically rather than modify the system CLASSPATH variable.

Anyway, you can achieve this yourself by opening a command prompt and doing:
set CLASSPATH .
Now run Tomcat from there (although the default scripts should ignore the 
classpath anyway, now that I think about it).

Anyway, try that out.  If that doesn't help, maybe if you have a sample 
application you can send to me, I can test it out myself to see if I get 
logging or not.  Some source code would also be good so I know where to 
expect logging statements to come from.

Jake

At 01:27 PM 8/8/2003 -0400, you wrote:
Keith,

The problem I have with removing all that stuff is that 90% of it was put
there by applications.  Should I remove parts of it anyway?  I guess that's
where my confusion is since (as I said) most of these variables were entered
by the installation of the applications themselves.
Thanks for your thoughts Keith!

-Original Message-
From: Keith Hatton [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 12:18 PM
To: Log4J Users List
single period = . = class files etc. based on this directory only.

It's just that the CLASSPATH environment variable often does more harm than
good.
If you use java -cp something then the CLASSPATH is ignored, and often
scripts that start Java apps will do just that. But then again, sometimes
they add your CLASSPATH to theirs. That's when the trouble starts ...
So basically, Jake's advice is, remove your CLASSPATH environment variable
if at all possible. Certainly that sounds like way too much junk in there.
Hope this helps
Keith
-Original Message-
From: Farrell, Timothy [mailto:[EMAIL PROTECTED]
Sent: 08 August 2003 17:00
To: Log4J Users List
Subject: RE: New issue on Log4J initialization
Can you (or someone)explain your first statement (I'd change your classpath
to be no more than a single period)?
I have both installed on my machine however, I only run one at a time
depending on what I am working on.
My app does not use struts or anything else requiring commons-logging.

Jake,

Enjoy your vacation!  And thanks again.

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 11:49 AM
To: Log4J Users List
Yikes.  I'd change your classpath to be no more than a single period.  Set
the classpath as needed in scripts.  That way, you won't force libraries
that aren't needed or collide with other libraries on every app you run.
Just to be clear.  Are you running Tomcat or Websphere?  I can't tell you
what the behavior in Websphere will be.  Tomcat should definitely work for
logging, though.
BTW, what does your app consist of?  Does it use Struts or anything else
requiring commons-logging?  That's the most evil invention to come out of
the Apache project.  In my experience, it just messes up everything.  If
this is an issue with commons-logging, you'll have to take it up with them.
BTW, I will be leaving for a mini vacation shortly, so someone else is
probably going to have to take the reins on this one if you require more
help.
good luck!

Jake

At 11:11 AM 8/8/2003 -0400, you wrote:
Actually that is the message I am getting (I just abbreviated it a bit).

In my application the log4j.jar file does not exist in the common/lib
directory of Tomcat.  This file only exists in the web-inf/lib directory of
my application.

Could this be attributed to my environmental settings:
.;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;
E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar;
E:\Tomcat 4.1\common\lib\servlet.jar;
E:\Tomcat 4.1\bin\bootstrap.jar;
E:\Sandbox\build\classes;
C:\j2sdk1.4.1_01\bin;
E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar;
E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar

Thanks for hanging in there.

Sincerely,

Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 10:57 AM
To: Log4J Users List


There doesn't appear to be anything wrong with your log4j.xml (except that
you should use level rather than priority, but that isn't the issue
here).

Note

Re: New issue on Log4J initialization

2003-08-14 Thread Jacob Kjome
There doesn't appear to be anything wrong with your log4j.xml (except that 
you should use level rather than priority, but that isn't the issue here).

Note that the error you've mentioned in previous emails is not an issue here...

Log4j: WARN No appenders could be found for logger 
(org.apache.commons.digester.Digester.sax).  Please initialize the log4j 
system properly.

I'd bet that goes away if you remove log4j.jar from 
CATALINA_HOME/common/lib (please test this out).  Having log4j.jar in 
WEB-INF/lib of your application provides for a separate logging environment 
since it is in a distinct classloader.

I'm at a loss as to why you are not seeing debug message?  You are running 
code that does logger.debug(), right?

Anyone else have a clue what is happening here?

Jake

At 09:49 AM 8/8/2003 -0400, you wrote:
Can anyone see anything wrong with this log4j.xml file?  For some reason I
cannot get lof4j to initialize and it's driving me crazy.  I am sure it is
something I am doing wrong but I can't seem to locate the problem.
The error message I am getting is:

No appenders could be found for logger.  Please initialize the log4j system
properly .
Here is the log4j file:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
!-- For Ant build --
log4j:configuration
!-- order of elements: renderer*, appender*, (category | ...) , root --
appender name=LF5 class=org.apache.log4j.lf5.LF5Appender
param name=MaxNumberOfRecords value=1000/
/appender
appender name=file class=org.apache.log4j.RollingFileAppender
param name=file value=build.log/
param name=maxBackupIndex value=3/
param name=maxFileSize value=100KB/
layout class=org.apache.log4j.TTCCLayout/
/appender
!-- if using this in ant, be sure the java mail libraries are avaiable
--
appender name=mail class=org.apache.log4j.net.SMTPAppender
param name=Threshold value=debug/
param name=SMTPHost value=bh1.compuware.com/
param name=bufferSize value=1/
param name=to value=[EMAIL PROTECTED]/
param name=from value=[EMAIL PROTECTED]/
param name=subject value=Ant test/
layout class=org.apache.log4j.HTMLLayout/
/appender
appender name=STDOUT class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=[%t] %C{2} (%F:%L) -
%m%n/
/layout
/appender
root
priority value=debug /
appender-ref ref=STDOUT /
appender-ref ref=file/
   !-- appender-ref ref=mail/ --
   !-- appender-ref ref=LF5/ --
/root
/log4j:configuration

Thank you for your help.



The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.
-
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: New issue on Log4J initialization

2003-08-12 Thread Jacob Kjome
When you say version 5.0, do you literally mean version 5.0 or the 
latest version of the 5.0 series which is 5.0.7?  I tested on 5.0.7 and 
don't get the message at all if log4j.jar is *not* in common/lib.  I do get 
the message (but actually a slightly different one) if log4j.jar *is* in 
common/lib.  However, I can fix this by adding the following log4j.xml file 
to common/classes

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; 
debug=false threshold=debug
appender name=A1 class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%-4r [%t] %-5p %c %x - 
%m%n/
/layout
/appender

root
level value=info/
appender-ref ref=A1/
/root
/log4j:configuration
I suggest upgrading to Tomcat-5.0.7 if you haven't already and add the 
above log4j.xml to common/classes.

Jake

At 03:24 PM 8/11/2003 -0400, you wrote:
Yes it is a clean install (version 5.0).  I decided that since I could get
logging to work with v4.1.27 that I would re-try v5.0 again.
One thing that I noticed was that there was log4j path information in my
classpath, so I took that out.  I rebooted the machine and tried to start
Tomcat again.  I got the same appender messages.
-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 2:49 PM
To: Log4J Users List
What version of Tomcat are you using?  And is it a clean install?  That is,
a stock install with nothing else added to it.
Jake

At 02:10 PM 8/11/2003 -0400, you wrote:
Jake,

Before I go on I want to thank you for all your help and patience.

I decided to test something out and totally removed my application and all
instances of our log4j-1.2.8 jar file.

Guess what happens?

I still get the error:

Log4j: WARN No appenders could be found for logger
org.apache.commons.digester.Digester.sax).  Please initialize the log4j
system properly.

What are your thoughts about this?

Thanks again.

Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 10:45 AM
To: Log4J Users List

At 09:25 AM 8/11/2003 -0400, you wrote:
 Jake,
 
 Having done as you said I am now getting a log file generated

Glad you got things going.  What do you think was the difference?  Can you
pinpoint the one change that made things start working?  It would be good
to know for future users having the same or similar problems.

 , although I
 still get the original error message from Tomcat:
 
 Log4j: WARN No appenders could be found for logger
 org.apache.commons.digester.Digester.sax).  Please initialize the log4j
 system properly.
 
 Any way to get that message to stop displaying?

Did you put a copy of log4j.jar back into common/lib?  That error is coming
from commons-logging finding Log4j and using it in preference to j2sdk1.4.x
logging, but if Log4j doesn't, then, find its configuration, you will get
that error.  Note that commons-logging does a bunch of classloading
trickery to find and load external logging packages.  It is entirely
possible that it might be using the context class loader to find Log4j,
thus being able to bypass the normal Java2 classloader hierarchy (where
only classloader higher in the hierarchy are visible).  However, I just
tested having log4j.jar in my WEB-INF/lib and not in common/lib and
commons-logging in common/lib couldn't see it (and, therefore, didn't get
the Log4j error), so it is most likely that you have log4j.jar in
common/lib (or shared/lib) or some other place where commons-logging in
Tomcat can see log4j.jar.  Remove Log4j.jar and you won't see that
erroror, I suppose, you could add log4j.xml or log4j.properties to
common/classes and all would be well.

Jake

 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]
 Sent: Monday, August 11, 2003 2:05 AM
 To: Log4J Users List
 
 Hi Timothy,
 
 This is why, when possible, I install apps manually by simply unzipping
 them to a directory rather than running some fancy install which I have
no
 control over.  I do this with Tomcat.  I suppose this isn't possible with
 current versions of Websphere, but they really shouldn't be modifying
your
 classpath anyway.  I'd send them a complaint about this so that they stop
 this practice in the future.  Their batch scripts should set everything
up
 dynamically rather than modify the system CLASSPATH variable.
 
 Anyway, you can achieve this yourself by opening a command prompt and
doing:
 set CLASSPATH .
 
 Now run Tomcat from there (although the default scripts should ignore the
 classpath anyway, now that I think about it).
 
 Anyway, try that out.  If that doesn't help, maybe if you have a sample
 application you can send to me, I can test it out myself to see if I get
 logging or not.  Some source code would also be good so I know where to
 expect logging statements

RE: Separate configs for different webapps

2003-08-12 Thread Jacob Kjome
At 09:07 AM 8/11/2003 -0400, you wrote:

Howdy,
Thanks Jake for adding the links: your solution will work, I've tried it
myself in the past.
That said, I fully agree with Senor Coast's advice to not share jars
across webapps, even if they're exactly the same.  Keep all the jars for
your webapp, including common ones, in WEB-INF/lib.  Or just deploy as
one WAR file.  Webapps are supposed to be self-contained, and you will
save yourself many configuration and debugging hassles if you stick to
this principle.
Sure, but is there even a choice under a server like JBoss where they have 
their single classloader concept?  I say this theoretically, not from 
experience logging under JBoss, but it seems like a valid theoretical 
problem if there aren't separate classloaders.  Also, disregarding the 
specific container being used,  if you were deploying an EJB project where 
you wanted a single logging configuration for the whole app including 
servlets, would you be able to set this up from the servlet?  Are EJB's 
supposed to be able to have access to classes in WEB-INF/lib?  I would 
think not since it isn't guaranteed that the EJB's even exist in the same 
JVM.  Sorry, just haven't explored logging in these cases as much as with 
servlet apps.

Jake

Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 1:53 AM
To: Log4J Users List
Subject: RE: Separate configs for different webapps


This should be possible using separate logger repositories
per/webapp.  Please see:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppConta
iner
Logging

I've added a link to this in the wiki FAQ as well:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Frequent
lyAs
kedQuestions

Jake

At 01:50 PM 8/8/2003 -0700, you wrote:
Follow on question...

Some of my code is shared among several webapps.  We've been
installing
the
jar files in the tomcat shared/lib directory.  I'd like the log
messages
from these shared components to use the same logging configuration as
the
specific webapp that is calling them is using.  Essentially things
running
on a particular thread (and child threads it starts) would use the
same
log
configuration.

If I use the solution mentioned (i.e., putting the log4j.jar in the
webapp's
classes directory), it seems like this will only cause the classes
associated with the webapp to use the logging configuration?  In other
words, won't log calls from the shared jars use a different logging
configuration than the webapp methods that are calling them?

If this is a problem, then is there a way around it?

It seems like I want some type of logging context that I can
establish
on
a thread that defines ALL of the log settings, not just a name.

Pat

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 10:57 AM
To: Log4J Users List
Subject: RE: Separate configs for different webapps



Howdy,
Yes.  Instead of them sharing log4j.jar, put a copy of the jar in each
app's WEB-INF/lib folder.  Then keep the separate config files as
you've
done, in each app's WEB-INF/classes folder.  Make sure there's no
log4j.jar in tomcat's common/lib directory.

Yoav Shapira
Millennium ChemInformatics


 -Original Message-
 From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 08, 2003 12:37 PM
 To: [EMAIL PROTECTED]
 Subject: Separate configs for different webapps
 
 Hi,
 
 I am probably asking a stupid question here because I am new to
log4j
and
 tomcat.
 
 I have two webapps running under tomcat (single JVM) that are
sharing
 common
 libraries.  I am trying to find a way to set up the logging
properties
such
 that the two webapps have different settings (i.e., different
appenders,
 layouts, levels, etc.).  I've tried putting a log4j.properties file
in
the
 classes directory for each of my webapps, but it seems it only
 automatically
 picks up the one associated with whichever webapp is started first
by
 tomcat
 (the other one is never loaded).  If I put an explicit call in both
webapps
 to the PropertyConfigurator, it seems that whichever one loads last
 overwrites the previous settings.  Can I get different settings for
each of
 my webapps somehow?
 
 Pat Grever
 Software Development Engineer
 iIPS Connectivity - Management  Applications Lab
 Phone:  208.396.2522
 Fax:  208.396.4796
 [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

RE: Separate configs for different webapps

2003-08-11 Thread Jacob Kjome
This should be possible using separate logger repositories 
per/webapp.  Please see:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

I've added a link to this in the wiki FAQ as well:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/FrequentlyAskedQuestions
Jake

At 01:50 PM 8/8/2003 -0700, you wrote:
Follow on question...

Some of my code is shared among several webapps.  We've been installing the
jar files in the tomcat shared/lib directory.  I'd like the log messages
from these shared components to use the same logging configuration as the
specific webapp that is calling them is using.  Essentially things running
on a particular thread (and child threads it starts) would use the same log
configuration.
If I use the solution mentioned (i.e., putting the log4j.jar in the webapp's
classes directory), it seems like this will only cause the classes
associated with the webapp to use the logging configuration?  In other
words, won't log calls from the shared jars use a different logging
configuration than the webapp methods that are calling them?
If this is a problem, then is there a way around it?

It seems like I want some type of logging context that I can establish on
a thread that defines ALL of the log settings, not just a name.
Pat

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 10:57 AM
To: Log4J Users List
Subject: RE: Separate configs for different webapps


Howdy,
Yes.  Instead of them sharing log4j.jar, put a copy of the jar in each
app's WEB-INF/lib folder.  Then keep the separate config files as you've
done, in each app's WEB-INF/classes folder.  Make sure there's no
log4j.jar in tomcat's common/lib directory.
Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: GREVER,PAT (HP-Boise,ex1) [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 12:37 PM
To: [EMAIL PROTECTED]
Subject: Separate configs for different webapps

Hi,

I am probably asking a stupid question here because I am new to log4j
and
tomcat.

I have two webapps running under tomcat (single JVM) that are sharing
common
libraries.  I am trying to find a way to set up the logging properties
such
that the two webapps have different settings (i.e., different
appenders,
layouts, levels, etc.).  I've tried putting a log4j.properties file in
the
classes directory for each of my webapps, but it seems it only
automatically
picks up the one associated with whichever webapp is started first by
tomcat
(the other one is never loaded).  If I put an explicit call in both
webapps
to the PropertyConfigurator, it seems that whichever one loads last
overwrites the previous settings.  Can I get different settings for
each of
my webapps somehow?

Pat Grever
Software Development Engineer
iIPS Connectivity - Management  Applications Lab
Phone:  208.396.2522
Fax:  208.396.4796
[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]


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


RE: New issue on Log4J initialization

2003-08-09 Thread Jacob Kjome
Yikes.  I'd change your classpath to be no more than a single period.  Set 
the classpath as needed in scripts.  That way, you won't force libraries 
that aren't needed or collide with other libraries on every app you run.

Just to be clear.  Are you running Tomcat or Websphere?  I can't tell you 
what the behavior in Websphere will be.  Tomcat should definitely work for 
logging, though.

BTW, what does your app consist of?  Does it use Struts or anything else 
requiring commons-logging?  That's the most evil invention to come out of 
the Apache project.  In my experience, it just messes up everything.  If 
this is an issue with commons-logging, you'll have to take it up with them.

BTW, I will be leaving for a mini vacation shortly, so someone else is 
probably going to have to take the reins on this one if you require more help.

good luck!

Jake

At 11:11 AM 8/8/2003 -0400, you wrote:
Actually that is the message I am getting (I just abbreviated it a bit).

In my application the log4j.jar file does not exist in the common/lib
directory of Tomcat.  This file only exists in the web-inf/lib directory of
my application.
Could this be attributed to my environmental settings:
.;E:\Program Files\IBM\WebSphere MQ\Java\lib\providerutil.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\ldap.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\jta.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\jndi.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\jms.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\connector.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\fscontext.jar;
E:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;
E:\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8;E:\istrobe20jars\dom4j.jar;
E:\Tomcat 4.1\common\lib\servlet.jar;
E:\Tomcat 4.1\bin\bootstrap.jar;
E:\Sandbox\build\classes;
C:\j2sdk1.4.1_01\bin;
E:\Ant1.5.3\apache-ant-1.5.3-1\lib\ant.jar;
E:\Ant1.5.3\apache-ant-1.5.3-1\lib\optional.jar
Thanks for hanging in there.

Sincerely,

Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Friday, August 08, 2003 10:57 AM
To: Log4J Users List
There doesn't appear to be anything wrong with your log4j.xml (except that
you should use level rather than priority, but that isn't the issue
here).
Note that the error you've mentioned in previous emails is not an issue
here...
Log4j: WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).  Please initialize the log4j
system properly.
I'd bet that goes away if you remove log4j.jar from
CATALINA_HOME/common/lib (please test this out).  Having log4j.jar in
WEB-INF/lib of your application provides for a separate logging environment
since it is in a distinct classloader.
I'm at a loss as to why you are not seeing debug message?  You are running
code that does logger.debug(), right?
Anyone else have a clue what is happening here?

Jake

At 09:49 AM 8/8/2003 -0400, you wrote:
Can anyone see anything wrong with this log4j.xml file?  For some reason I
cannot get lof4j to initialize and it's driving me crazy.  I am sure it is
something I am doing wrong but I can't seem to locate the problem.

The error message I am getting is:

No appenders could be found for logger.  Please initialize the log4j system
properly .

Here is the log4j file:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
!-- For Ant build --
log4j:configuration
!-- order of elements: renderer*, appender*, (category | ...) , root --

 appender name=LF5 class=org.apache.log4j.lf5.LF5Appender
 param name=MaxNumberOfRecords value=1000/
 /appender

 appender name=file class=org.apache.log4j.RollingFileAppender
 param name=file value=build.log/
 param name=maxBackupIndex value=3/
 param name=maxFileSize value=100KB/
 layout class=org.apache.log4j.TTCCLayout/
 /appender

 !-- if using this in ant, be sure the java mail libraries are
avaiable
--
 appender name=mail class=org.apache.log4j.net.SMTPAppender
 param name=Threshold value=debug/
 param name=SMTPHost value=bh1.compuware.com/
 param name=bufferSize value=1/
 param name=to value=[EMAIL PROTECTED]/
 param name=from value=[EMAIL PROTECTED]/
 param name=subject value=Ant test/
 layout class=org.apache.log4j.HTMLLayout/
 /appender

 appender name=STDOUT class=org.apache.log4j.ConsoleAppender
 layout class=org.apache.log4j.PatternLayout
 param name=ConversionPattern value=[%t] %C{2} (%F:%L) -
%m%n/
 /layout
 /appender

 root
 priority value=debug /
 appender-ref ref=STDOUT /
 appender-ref ref=file/
!-- appender-ref ref=mail/ --
!-- appender-ref ref=LF5/ --
 /root

/log4j:configuration

Thank you for your help.



The contents of this e-mail are intended for the named addressee only

RE: how do i get Log4j in Tomcat environment?

2003-08-07 Thread Jacob Kjome
I see that error in Tomcat5 as well.  I assume you have log4j.jar in 
CATALINA_HOME/common/lib?  Did you also add log4j.jar to WEB-INF/lib of 
your application?  If not, do that and make sure your log4j.xml is in 
WEB-INF/classes.  Everything should work fine for you.  The error is 
inconsequential.  When commns-logging (which Tomcat uses) finds log4j.jar, 
it uses it but there seems to be something wrong with the way they are 
configuring it.  It shouldn't affect your application in the least.  Just 
ignore the message.  Having log4j.jar in WEB-INF/lib gives you a completely 
separate logging environment than that of the server.

BTW, are you not getting any logging from your application?  You should be 
if you have things configured correctly as I've described above.

Jake

At 09:57 AM 8/7/2003 -0400, you wrote:


I am getting a startup error now on Log4J that is hopefully leading me to a
solution.  The error is:


Log4j: WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).  Please initialize the log4j
system properly.


I am currently running Tomcat 4.1.27 on XP-Pro.  I checked the log4j.xml
file and it includes the necessary appenders.  Does anyone know what may be
causing this error.


Thanks.



Tim

-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 2:58 PM
To: Log4J Users List
What exactly is the current problem you are having?  Just add log4j.jar to
WEB-INF/lib and log4j.properties or log4j.xml to WEB-INF/classes and you
are ready to go.  There are a couple of other options that are more
advanced, but this should get you going for now.
Jake

At 06:39 PM 8/6/2003 +0100, you wrote:
Hi,
Trying to use log4j in Tomcat environment. Seen loads of messages on
this but haven't got
Much useful stuff from them. Could someone direct me to an appropriate
resource.
Thanks
KB
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.
-
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: Picking up wrong properties file in Weblogic

2003-08-04 Thread Jacob Kjome
At 07:50 AM 8/4/2003 -0500, you wrote:
You pretty much have two options...
1) Seek out all libraries using either log4j/commons-logging and moving them
from the server class-path to the appropriate app-specific directory.
2) Place your log4j.properties file also in the system/server class-path.
There are 2 other options.

1.  I'm not sure how Websphere is set up with its classloaders, but if it 
complies with the servlet spec, the WebappClassLoader should be checked 
first before any other class loaders.  Note this is inverse to the standard 
Java2 class loader delegation model.  You can take advantage of this by 
putting log4j.jar in WEB-INF/lib of your app.  It shouldn't matter one bit 
whether other apps are using log4j at all unless other libraries in your 
webapp are performing configuration after you have done your.  But you 
shouldn't have to worry about applications (or the server itself) 
configuring log4j outside of your webapp.  Their default logger repository 
will be separate from yours.

2.  If that doesn't work, then this is guaranteed to work.  Use a separate 
logger repository to log messages for you app.  All the other app using 
log4j are using the default logger repository.  If you use a custom logger 
repository selector to set a distinct logger repository for each app, then 
none of them will collide.  See...
http://www.qos.ch/logging/sc.html

this might also be helpful...
http://www.onjava.com/pub/a/onjava/2003/04/02/log4j_ejb.html
For a couple implementations of repository selectors, look here...
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/
Take a look at the InitContextListener to utilize the repository selectors 
in a webapp...
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitContextListener.java

Jake 

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


Re: log4j fighting with commons-logging in Tomcat 4.1.24

2003-07-25 Thread Jacob Kjome
Put log4j.properties in WEB-INF/classes of your webapp.

Jake

At 08:52 AM 7/25/2003 -0500, you wrote:
I just started using Tomcat 4.1 (moving from another server). My apps
were all coded to use the Log4j logger (1.2.8). Here's my problem.
When starting up, Tomcat apparently uses commons-logging.jar (actually,
it first uses commons-logging-api.jar??). It creates a default console
appender for my loggers in a format I hate (milliseconds-since-start
[Thread-x] LEVEL category - text). Now, my log4j.properties file, which
I've put into the $CATALINA_HOME/common/classes directory, also sets up
a console appender (in a format I like). Both of these appenders now
write to the console, so I get 2 lines for each logger entry.
Question: How the heck do I get rid of (or change the format of) the
default console appender that Tomcat creates??  I know I can write some
initialization servlet to get all the loggers from the root and remove
the appender, but I'd really like to do this via properties or xml
config files. What I'd really like is an understanding of where the
original logger's console appender is being created in the standard
Tomcat 4.1.24 install.
(I've searched the FAQs, RTFM'd, and moved properties and jar files all
over the place, but I *cannot* figure this out!!)
Mike



The information in this email may be confidential and/or privileged.  This
email is intended to be reviewed by only the individual(s) or
organization(s) named above.  If you are not an intended recipient, then
any review, dissemination or copying of this email, any attachments or any
information contained herein is prohibited.  If you have received this
email in error, please immediately notify the sender by return email and
delete this email from your system.   This email and any attachments
are not intended to constitute an offer or acceptance and do not create or
evidence a contract or any amendment to a contract between Security
Broadband and the intended recipient(s) or any other party.  This email
and any attachments may not be relied on by anyone as the basis of a
contract.  By sending this email, the sender does not consent to conduct
(by electronic means) any transactions that may be the subject of this
email.  Any such consent must be separately and expressly obtained in
writing manually executed by an authorized representative of Security
Broadband.
-
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: Get line number but using a wrapper class

2003-07-10 Thread Jacob Kjome
You need to tell javac to compile with debug flags, otherwise the line 
numbers will not be provided.

Jake

At 07:26 PM 7/10/2003 +0200, you wrote:
Dear Steven and all

Thanks for the reply.
I tried and follow the examples in the mailing list.
Now I have a strange problem.
If have two web applications which are using SAME wrapper class.
One can display method name and line number correct and the second shows
method name and a question mark for the line number.
Webapp | method name | line number
1   ok  ok
2   ok  ?
Currently I cannot see any different in the two web applications.
Just one is compiled with make and the other is compiled with ant.
But I'm not sure if this is the reason.
If someone has a similar problem any information is highly appreciated.

Thanks

Joerg



 -Original Message-
 From: Ebersole, Steven [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 10, 2003 4:43 PM
 To: 'Log4J Users List'
 Subject: RE: Get line number but using a wrapper class


 This has been covered _NUMEROUS_ times on the mailing list.
 You need to use the Logger.log(String,Level,Object,Throwable)
 method from within your wrapper.  See the javadocs for that method.



 -Original Message-
 From: Joerg Eggink [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 10, 2003 9:37 AM
 To: [EMAIL PROTECTED]
 Subject: Get line number but using a wrapper class


 Dear all

 I want to write my own log4j wrapper class but I want also
 the line number in the output of each statement.

 I this possible ?
 Does log4j keep the line number of the wrapper log statement
 or the line number of the wrapper class ?


 Regards

 Joerg


 ---
 Joerg Eggink
 ACCESS Systems Europe GmbH
 Essener Str. 5 / TZU-VI
 D-46047 Oberhausen / Germany
 Tel.: +49-208-8290-6436
 mailto: [EMAIL PROTECTED]
 Internet: www.access-sys-eu.com


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


Re: common-logging, struts, Log4j, tomcat

2003-06-26 Thread Jacob Kjome
At 12:51 PM 6/26/2003 +, you wrote:
Hi. I have problem in using the common-logging with struts and
Log4j. I am basically lost. I  have short questions, I appreciate if
anyone can help me little bit. these are the questions with examples:
First, if you are using commons-logging, then that is a question for 
another list.  If you are using log4j directly, which your configuration 
file below seems to suggest, then read on...

The file outputfile.log that I specify in
log4j.appender.LOGFILE.File=outputfile.log where it is located?
where I find it? is it physical file?
If you specify your file like this, it will be written to the location 
where the JVM is started.  If you are using Tomcat's startup scripts, then 
this would be in CATALINA_HOME/bin.  Look there for your outputfile.log.

I dont know why my configuration is not working, although I put the
following files in the classpath WEB-INF/classes/org/myclasses/:
huh?  How did you come up with this as a valid place to put your 
log4j.properties file for automatic discovery by log4j?  Try plain old 
WEB-INF/classes which is where it should be.

commons-logging.properties:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
ogger
No idea.  This list isn't about commons logging, nor do I encourage its use 
since it seems to be the cause of so many problems.  Just use log4j 
directly if possible, although I know struts uses it so you have to have it 
present there.

log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%
n
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=outputfile.log
log4j.appender.rolling.MaxFileSize=100KB
log4j.appender.rolling.MaxBackupIndex=1
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p %
c - %m%n
This looks fine.  If you follow my comments above, this should work.

What else should I specify, or configure to make it to work? I have
log4j-1.2.4.jar in my WEB-INF/lib/
Why are you using such an ancient version of log4j?  log4j-1.2.8.jar is the 
latest and has some important fixes, so I highly recommend the upgrade.

Should I set any system propreties? or web.xml? or struts-config?

In my classes I am doing that:
  protected static final org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog(this.class);
if (log.isDebugEnabled())
  log.debug(getMessage( + locale + , + key + ));
(How can I enable/disable the Debug or Trace?)
No idea.  Again, this is commons-logging you are talking about.  Ask their 
list.


Thank you in advance. I am really stuck and I couldnt make it to
work. I am using tomcat 4.18
Why not Tomcat-4.1.24, the latest bugfixed version of Tomcat?  Again, I 
highly recommend the upgrade.

Jake


Rabih



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


RE: RollingFileAppender logs to console, why?

2003-06-24 Thread Jacob Kjome
Log4j, by default, uses a single logger repository.  So, unless you log 
within the context of your own custom logger repository, the last entity to 
configure log4j will have configured log4j for every app using the default 
logger repository.  This is not usually a concern in a standalone app, but 
in a container such as Websphere, you will have to take precautions in 
order to keep your app's logging configuration separate from others in the 
container.  There are a couple ways to do this...

1.  Put log4j in the WEB-INF/lib of each application.  Since each webapp 
should have its own classloader that other apps can't see (nor should the 
container be able to see it based on Sun's classloader heirarchy rules), 
the default logger repository is, essentially, reserved for use by your 
application alone.

2.  Use a custom logger repository selector to create a distinct logger 
repository for your application.  This allows for log4j to be in a global 
classloader that can be seen by all apps (and/or the container as well), 
but still provide a distinct logging environment for each application.  To 
do this, you will need to utilize an implementation of a logger repository 
selector; two of which exist in the log4j-sandbox project.

See:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/UsefulCode
specifically the links for the custom repository selectors and servlet stuff.
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/
Take a look at the InitContextListener to utilize the repository selectors 
in a webapp...
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitContextListener.java

The javadoc in that is pretty extensive and should show you how to use 
everything.

You can check out the latest CVS.  See instructions here:
http://jakarta.apache.org/site/cvsindex.html
Also see:
http://cvs.apache.org/viewcvs/jakarta-tomcat/proposals/Log4jHelper/
which is a separate logger repository implementation implemented for 
Tomcat-3.3.x.  Not yet for 5.x.x and probably won't be for 4.1.x.

Jake



At 01:31 PM 6/24/2003 -0700, you wrote:
 Are you sure you don't have a console appender
 defined as well?
yeah i am sure about that.
 Are you
 sure log4j is configured well, i.e. without errors?
will check that in the morning (am at home right now)
 Are you running
 within a container that's also using log4j?
Websphere Application Server 4.0 (not quite sure about
the version number, but i think it is.)
Does Websphere use log4J, i don't know...
thank you.
ruud.
--- Shapira, Yoav [EMAIL PROTECTED] wrote:

 Howdy,
 Are you sure you don't have a console appender
 defined as well?  Are you
 sure log4j is configured well, i.e. without errors?
 Are you running
 within a container that's also using log4j?

 Yoav Shapira
 Millennium ChemInformatics


 -Original Message-
 From: Ruud Steeghs [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 24, 2003 3:38 PM
 To: [EMAIL PROTECTED]
 Subject: RollingFileAppender logs to console, why?
 
 Hi,
 
 I've configured log4j to log to a
 RollingFileAppender.
 However, it also logs to console. This is something
 I
 do not want.
 Anyone has any idea how to prevent log4j from
 logging
 to the console as well?
 
 regards,
 Ruud.
 
 __
 Do you Yahoo!?
 SBC Yahoo! DSL - Now only $29.95 per month!
 http://sbc.yahoo.com
 

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

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Problems with log4j and WebLogic

2003-06-14 Thread Jacob Kjome
NoClassDefFoundError means that you probably have conflicting versions of 
Log4j in your classpath.  Try to set it up where you only have one copy of 
log4j.jar in your classpath and see if that fixes things.

Jake

At 03:25 AM 6/14/2003 -0700, you wrote:
I am trying to get log4j working with a very simple
session bean in weblogic 7.0.  The bean works fine if
I comment out all of the logging code.  If I leave the
logging code in I get this exception:
java.lang.NoClassDefFoundError:
org/apache/log4j/Category
at java.lang.Class.getMethods0(Native Method)
at java.lang.Class.getMethods(Class.java:737)
at
weblogic.ejb20.ejbc.EJBCompiler.computeCRC(EJBCompiler.java:626)
at
weblogic.ejb20.ejbc.EJBCompiler.makeFileHash(EJBCompiler.java:539)
at
weblogic.ejb20.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:160)
at
weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:332)
at
weblogic.ejb20.deployer.EJBDeployer.runEJBC(EJBDeployer.java:489)
at
weblogic.ejb20.deployer.EJBDeployer.compileEJB(EJBDeployer.java:819)
at
weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1268)
at
weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:232)
at
weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:1570)
at
weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:737)
at
weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:555)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1062)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:730)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
--- nested within: --
weblogic.management.ManagementException: 149233 - with
nested exception:
[java.lang.NoClassDefFoundError:
org/apache/log4j/Category]
at
weblogic.management.deploy.slave.SlaveDeployer.convertThrowable(SlaveDeployer.java:834)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1180)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:730)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
at
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)


Here is all of the pertinent information I can think
of:
The manifest for the EJB JAR:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: 1.3.1_07-b02 (Sun Microsystems Inc.)
Built-By: Jerry Cattell
Built-On: 2003-06-14T06:13:20
Class-Path: log4j-1.2.8.jar
The files in the EAR:
META-INF/MANIFEST.MF
test-ejb.jar
log4j-1.2.8.jar
log4j.properties
META-INF/application.xml
The files in the JAR:
META-INF/MANIFEST.MF
test/ejb/NetworkServerBean.class
test/ejb/NetworkServerSession.class
test/interfaces/NetworkServerLocal.class
test/interfaces/NetworkServerLocalHome.class
test/interfaces/NetworkServerRemote.class
test/interfaces/NetworkServerRemoteHome.class
test/util/NetworkServerUtil.class
META-INF/ejb-jar.xml
META-INF/weblogic-ejb-jar.xml
If someone can see what I'm doing wrong, I would
greatly appreciate it.
Thanks,
Jerry
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Problem configuring log4j with common classes

2003-06-12 Thread Jacob Kjome
If you load the properties file with a file name, it will look for the file 
in the location where the java process was started unless you provide an 
absolute path to the file.  The better way to do this is load it off the 
classloader and then provide it as an inputstream or URL to the configure 
method.

Jake

At 12:37 PM 6/12/2003 -0400, you wrote:
Thanks Alison!!
Now I'm almost ready with my configuration, but the last (I hope) problem 
is where to put the log4j.properties for the common classes. I've tried 
putting the file inside the jar, on the root folder, and initializing it 
with the next sentence on a static block, in a class located inside of 
this jar:

static{
PropertyConfigurator.configure(log4j.properties);
}
When log4j tried to read this file, it throws me a FileNotFoundException.

What am I doing wrong

Thank you very much!!

Atte,
Carlos Yaconi Hitschfeld
Anexo: 8-4619
Teléfono: 388-4619
-Mensaje original-
De: Alison Ortega [mailto:[EMAIL PROTECTED]
Enviado el: Miércoles, 11 de Junio de 2003 14:24
Para: [EMAIL PROTECTED]
Asunto: RE: Problem configuring log4j with common classes
What you have looks right, just do a static initializer block in your 
common classes like this: ... code to get the init file name and prefix 
... static { PropertyConfigurator.configure(prefix+file);
}

It goes in the class/instance data declarations section of your common 
class.  I suppose you could use an init servlet here, but then you would 
have to deploy your common classes as an app, which I didn't want to do. 
Btw, if you want to not have all the app logs duplicated in the common 
class logs, change the common class properties file to use
log4j.rootCategory = info, appender list
instead of
log4j.logger...=info, appender list
and that will make the appender in the common class properties file the 
root one, and you can prevent the other loggers (categories) from logging 
to the parent (root) more easily.

Let me know if you have any other questions.

Alison Ortega
North Carolina State University
ACS
Systems Programmer II
919-513-1417
-
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: Problem configuring log4j with common classes

2003-06-12 Thread Jacob Kjome
Depends where the properties file exists.  For example (in examples below 
MyClass.class is used so you can access this behavior in static contexts as 
well as instance contexts.  If you have a current instance, you can use 
this.getClass())...

//loads my.properties in the same relative package location as MyClass.class
InputStream is = MyClass.class.getResourceAsStream(my.properties):
//loads my.properties in the default (root) package
InputStream is = MyClass.class.getResourceAsStream(/my.properties):
//loads my.properties from the my/package package anywhere in the current 
class loader
InputStream is = 
MyClass.class.getClassLoader().getResourceAsStream(my/package/my.properties):

//loads my.properties from the my/package package relative to the default 
(root) package in the current class loader
InputStream is = 
MyClass.class.getClassLoader().getResourceAsStream(/my/package/my.properties):

You can also replicate the latter two cases using the thread context class 
loader in order to load classes across any class loader in the JVM using...
Thread.currentThread().getContextClassLoader().getResourceAsStream(my/package/my.properties);
and
Thread.currentThread().getContextClassLoader().getResourceAsStream(/my/package/my.properties);

And then if you are in a servlet environment, you can do...
getServletContext().getResourceAsStream(/WEB-INF/props/my.properties);
Hope that was specific enough for you.

Jake

At 12:51 PM 6/12/2003 -0400, you wrote:
Thanks... But, can you give some example please??
I'm newbie with log4j and I don't know how to do it.
Thank you!

Atte,
Carlos Yaconi Hitschfeld
Anexo: 8-4619
Teléfono: 388-4619
-Mensaje original-
De: Jacob Kjome [mailto:[EMAIL PROTECTED]
Enviado el: Jueves, 12 de Junio de 2003 12:45
Para: Log4J Users List
Asunto: RE: Problem configuring log4j with common classes


If you load the properties file with a file name, it will look for the file
in the location where the java process was started unless you provide an
absolute path to the file.  The better way to do this is load it off the
classloader and then provide it as an inputstream or URL to the configure
method.
Jake

At 12:37 PM 6/12/2003 -0400, you wrote:
Thanks Alison!!
Now I'm almost ready with my configuration, but the last (I hope)
problem
is where to put the log4j.properties for the common classes. I've tried
putting the file inside the jar, on the root folder, and initializing it
with the next sentence on a static block, in a class located inside of
this jar:

static{
 PropertyConfigurator.configure(log4j.properties);
}

When log4j tried to read this file, it throws me a
FileNotFoundException.

What am I doing wrong

Thank you very much!!

Atte,
Carlos Yaconi Hitschfeld
Anexo: 8-4619
Teléfono: 388-4619


-Mensaje original-
De: Alison Ortega [mailto:[EMAIL PROTECTED]
Enviado el: Miércoles, 11 de Junio de 2003 14:24
Para: [EMAIL PROTECTED]
Asunto: RE: Problem configuring log4j with common classes


What you have looks right, just do a static initializer block in your
common classes like this: ... code to get the init file name and prefix
... static { PropertyConfigurator.configure(prefix+file);
}

It goes in the class/instance data declarations section of your common
class.  I suppose you could use an init servlet here, but then you would
have to deploy your common classes as an app, which I didn't want to do.
Btw, if you want to not have all the app logs duplicated in the common
class logs, change the common class properties file to use
log4j.rootCategory = info, appender list
instead of
log4j.logger...=info, appender list
and that will make the appender in the common class properties file the
root one, and you can prevent the other loggers (categories) from logging
to the parent (root) more easily.

Let me know if you have any other questions.

Alison Ortega
North Carolina State University
ACS
Systems Programmer II
919-513-1417

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


Re: Custom loggers

2003-06-12 Thread Jacob Kjome
Hi Christian,

Search the archives for discussions on custom loggers using wrappers vs 
inheritance.  Actually, this was just discussed rather recently.  The 
wrapper the recommended way to go.

Jake

At 01:04 PM 6/12/2003 -0600, you wrote:
Hi folks,

Supposing I had a need to create and use a custom logger (ie. extending the
current logger), how would I go about doing that? Or is it a bad idea?
I know we did this at one point in the past (several years ago), but it was
kind of painful, and we were able to go away from it. But now we've got a
use for a custom logger again, and I guess I'm just wondering what the
standard approach should be?
I've looked in the docs but haven't seen anything (maybe I'm just missing
the obvious).
tia,
Christian
--
Christian Cryder
Internet Architect, ATMReports.com
Project Chair, BarracudaMVC - http://barracudamvc.org
--
Coffee? I could quit anytime, just not today
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Having LinkageError trouble with log4j under multiple contexts on Tomcat 4.04

2003-06-06 Thread Jacob Kjome
Hi Lukas,

I have tested these context listeners with multiple contexts and they work 
fine.  However, I'd only tested on Tomcat-4.1.xx, not 4.0.xx.   Not sure if 
that makes a difference? Try doing the following...

1.  copy log4j-1.2.8.jar (or latest CVS, I guess) to 
CATALINA_HOME/common/lib (or equivalent in Tomcat-4.0.xx).  I would just 
say shared/lb, but commons-logging seems to barf a bit when that is 
done.  Since Tomcat requires commons-logging, we'll try to play nice by 
adding the logj4 jar file to common/lib instead of shared/lib where I'd 
prefer to put custom jars.
2.  copy the selector jar file to CATALINA_HOME/shared/lib (or common/lib, 
but I'd avoid putting many custom jars there)
3.  copy the servlet jar to WEB-INF/lib of each webapp you are deploying
4.  set up context init parameters in each webapp's web.xml
5.  set up env-entry if using the ContextJNDISelector and make sure the 
env-entry-value is unique for each webapp

If you have problems with that, let me know.  It think the issue is that 
you have been putting the servlet jar in locations other than the 
WEB-INF/lib of each webapp.  I must stress that no matter what, the servlet 
jar *must* be under WEB-INF/lib no matter what.  Once that is done, the 
log4j jar and the selector jar must be in the same classloader so you can 
put these two jars in either WEB-INF/lib (somewhat defeats the purpose of 
this technique, but works...see below) or a combination of common/lib 
and shared/lib (see comments above and note that common/lib and shared/lib 
can see each other so, they are, in effect, the same classloader).

Alternatively, you can always just put all the jars in WEB-INF/lib of each 
webapp.  This provides you with exactly the same configuration options, but 
is kind of overkill since it creates a new logger repository when the 
default one would already be unique.  But, the configuration options are 
worth doing this, I think.  Your app won't know the difference.  Of course, 
you can forget about the custom selector and listeners and just put 
log4j.jar in each webapp's WEB-INF/lib and either rely on default 
configuration or perform your own.

Jake

At 11:18 PM 6/5/2003 +1200, you wrote:
Hello,

I've been using log4jfor a while now in a fairly basic way (using chainsaw)
and it has been fantastic.
My problem now is that i have several identical servlets running under
tomcat which need to log with different configurations. The problem (a
common one i believe) is that only the first context is working properly,
the second is either silently ignored (if log4j configures itself using the
default /classes/lo4j.properties file) or throws up some strange problems
(more on this in a second).
I've found this reference to what i think is the same  problem i am having,
http://marc.theaimsgroup.com/?l=log4j-userm=105284179922171w=2 . I have
built and deployed the servlet context listener as described. The context
listeners work fine, i can trace them starting up and stopping properly. The
first context loads properly and gets configured nicely, however the second
context throws a LinkageError error referring to the 'ErrorHandler' class
when it tries to configureAndWatch(). The application then shuts down after
the LinkageError.
Both contexts will run fine if the other is removed from the server, so i
know that both contexts _should_ work. I have tried moving the log4j jar and
the context listener jar around into the tomcat lib directory and so on
(which hasn't helped) but the target server is an ISP server so i don't
really have that option anyhow.
If anyone has any pointers or something that i've missed, it would be a
great help.
Log4j: current cvs
Tomcat: 4.04
Lukas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.471 / Virus Database: 269 - Release Date: 10/04/2003
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: how to overwrite log4j file EVERY time you write to it?

2003-06-06 Thread Jacob Kjome
I think you want a console appender or something that isn't so 
permanent.  Overwriting the file each time you log to it really defeats the 
purpose of logging to file.

Jake

At 10:01 AM 6/5/2003 -0600, you wrote:
I've just discovered this group, so my apologies if this has been posted
before. I looked through the archives but did not see this situation
previously addressed. I've ordered a manual, but it will be awhile before it
arrives.
I inherited a log4j properties file that is in xml format. One of my
appenders is described as follows:
 !-- A time/date based rolling appender for TPF Martindale Report Messages
--
  appender name=TPFMartindaleReport
class=org.jboss.logging.appender.DailyRollingFileAppender
param name=File
value=$\{cms.path\}/log/Martindale/tpfMartindale.report/
param name=Append value=false/
param name=Threshold value=DEBUG/
!-- Rollover at midnight each day --
param name=DatePattern value='.'-MM-dd/
layout class=org.apache.log4j.PatternLayout
  !-- The full pattern: Date MS Priority [Category] (Thread:NDC)
Message\\n --
  param name=ConversionPattern value=%d %-5r %-5p [%c] (%t:%x)
%m%n/
/layout
  /appender
We have an application that can run for days and uses this report to store
accumulated status information. With this particular report, every time I
log to it I would like to completely overwrite anything that might already
be in the file with the most current status. If I don't do this, I will be
repeating information. As you can see, I already have param name=Append
value=false/, but this only takes care of cases where the application is
restarted. Do you know of a way to overwrite a file EVERY TIME you log to it
without restarting your application?
Thank you for your help,
carol
Carol Chapman
Thomson Healthcare Inc.
Tel. 303-486-9199 (internal = ext. 6199)
Email: [EMAIL PROTECTED]



Re: Problem to load log4j.dtd

2003-05-29 Thread Jacob Kjome
Log4j-1.2.8 introduced a better entity resolving mechanism and should clear 
up the problem.  There were bugs in previous versions.  The change 
shouldn't do much other than fix your issue.  Test first, of course.

Jake

At 04:07 PM 5/28/2003 +0200, you wrote:
we use log4j in a production environment and it's not easy to change my
version of log4j.
Is there a bug with the 1.2.4 version that can explain my problem ?
In the line
 !DOCTYPE log4j:configuration SYSTEM log4j.dtd
what the word SYSTEM means ?
Can I specify where is my log4j.dtd file ?
Thanks for your help

Xavier



[EMAIL PROTECTED] wrote:

 Have you tried using 1.2.8?

 At 07:54 PM 5/27/2003 +0200, you wrote:

 my version of log4j is 1.2.4
 
 Xavier

 --
 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]
[EMAIL PROTECTED] wrote:

 Xavier,

 Which version of log4j are you using?

 At 06:37 PM 5/27/2003 +0200, you wrote:
 Hi,
 
 I use apache 2 and tomcat 4.1 and I want to start a web app that use
 log4j to log.
 My log4j.xml file is in my $CATALINA_BASE/conf directory and this
 directory is in my CLASSPATH.
 My log4j.dtd is also in $CATALINA_BASE/conf.
 
 In the log4j.xml file, I specify:
 !DOCTYPE log4j:configuration SYSTEM log4j.dtd
   log4j:configuration
 xmlns:log4j=http://jakarta.apache.org/log4j/;
 
 At the startup, tomcat find my log4j.xml file (as I can see in the
 catalina.out log), but the URL it uses for the log4j.dtd file is:
 
 jar:file:/opt/hpws/tomcat/common/lib/log4j-1.2.4.jar!/org/apache/log4j/ 
xml/log4j.dtd
 
 Why does-it use this URL ?
 How can I indicate where is my log4j.dtd file ?
 
 
 Thank you for your help
 
 Xavier

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


Re: is Logger serializable?

2003-04-02 Thread Jacob Kjome
If you make them class static variables, it is the same as marking them as 
transient.  The recommended way to define a logger is probably

private static final Logger logger = Logger.getLogger(MyClass.class.getName());

This will not be serialized.  If you don't make it static, then do...

private transient final Logger logger = 
Logger.getLogger(DBRApplicationGateway.class.getName());

Jake

At 06:03 PM 4/2/2003 -0600, you wrote:
Hello -

I am a brand new log4j user so this is probably a stupid question, but is a
Logger meant to be serializable? Or should I mark Logger instance variables
in my serializable bean classes as transient? The Serializable interface
isn't on Logger.
Thanks,
--
Anna Battenhouse
Internet Applications Architect
CCITRIAD, Inc.
804 Las Cimas Parkway, Suite 200
Austin TX 78746
(512) 278-5524
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Default configuration not seeing my appender

2003-03-28 Thread Jacob Kjome
You really don't have to worry about it.  Ant understands both and Java 
understands mixed use of / and \ when using file:///.

BTW, you can also do relative paths like this and it will work for both 
UNIX and Windows...

file:../WEB-INF/log4j.xml

Jake

At 11:14 AM 3/28/2003 -0500, you wrote:


Shapira, Yoav wrote:
Howdy,
Personally, I've encountered nothing but grief when attempting to work
with windows-style file paths.  (Or more general resource paths, e.g.
for JNDI).  I don't know if this is a shortcoming of java the language,
the File/URI/URL class implementations, the windows file system, or what
else, but I don't care.  Save yourself time and hassle and work
exclusively with unix style paths.
Yoav,

Thanks for your thoughts.  I am kind of new to using File I/O on Windows 
with Java because formerly my only deployment was to a Linux box.  I am 
running Cygwin on Windows, but I believe that only provides me with the 
convenience of Unix-style file paths in a shell.  Do you know of a way 
that I can force Ant to use Unix-style file paths even though it is 
technically a Windows machine?  Perhaps I should ask on ant-user.

At least in my Java code I can use Unix/Java-style file paths.

Erik

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


Re: Inherited Logger Config?

2003-03-28 Thread Jacob Kjome
See:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/UsefulCode
especially the links for...

Some custom repository selectors can be found in the current log4j cvs at 
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/. 
They will be released, in some packaged form, with v1.3, but they are 
compatible with current v1.2.X.

--
Web Application - Servlet related log4j classes can be found in the current 
log4j cvs at 
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/. 
They will be released, in some packaged form, with v1.3, but they are 
compatible with the current v1.2.X.

I wrote the selectors and the InitContextListener .  The javadoc should 
explain how to use this stuff.  You won't have to worry about log4j 
accidentally loading the wrong configuration file using this setup.

Jake

At 03:20 PM 3/28/2003 -0500, you wrote:


Jagadeesan,Sivakumar wrote:

In my web application, I have to set  system property to point to my config
file. This is kind of not good. Sometimes if I am deploying my application
in some ones server (like a Web Hosting Service Provider), I will not be
able to have such a system property, nor I could change the startup script
of the app server . So there should be some other way to do this.
I'm not writing to disagree with you, in fact what I'm about to say is 
sort of off-topic -- but couldn't you write a ContextListener that sets a 
System Property by reading a configuration file (of your own creation)?

Admittedly this gets a little convoluted -- you're using a config file to 
tell a ContextListener to set a System Property pointing to another config 
file that tells Log4J how to configure itself.  But in theory does it work?

Erik

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


Re: Reposting of Log4J Question

2003-02-25 Thread Jacob Kjome
Hello James,

The functionality you are looking for is to be able to log within
unique logger repositories using a custom logger repository selector.
I have implemented such a selector (and a servlet context listener
which configures log4j to use it at app/server startup) which keys
logger repositories on the current classloader.  Ceki has written
about a repository selector which would use JNDI to key logger
repositories.

Now, since you are using JBoss and they have their single classloader
concept (which, admittedly, I'm not so familiar with) I'm not sure the
repository selector that I wrote will work for you.  It certainly
works in an environment where each webapp has its own unique
classloader.  This still might be true for JBoss, but I'm not
positive.

To check out the repository selector I wrote, look here:
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/selector/ContextClassLoaderSelector.java?rev=1.3content-type=text/vnd.viewcvs-markup

See the servlet context listener which initializes Log4j to use this
custom selector here:
http://cvs.apache.org/viewcvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/servlet/InitContextListener.java?rev=1.2content-type=text/vnd.viewcvs-markup

Note that Log4j will only use *ONE* custom repository selector.  Once
one is installed, the only way to change it to re-install the selector
along with the original guard object which is used to protect the
selector from being changed by a process not meant to do so.  So,
unless you store the guard, you can pretty much assume that this is a
one-shot thing.  As such, ideally, the container should be responsible
for installing the selector.  My servlet context listener allows for
any particular webapp to install the selector if one isn't already
installed.  If one is, the installation will fail and the exception
hidden.  In this situation, it is assumed that whatever process did
the install knew what it was doing and the app will just have to live
with the decision.


For sure, read Ceki's article about custom selectors and pay attention
to the JNDI selector discussion:
http://qos.ch/logging/sc.html


Note, if you implement a JNDI selector that works for you, it would be
great if you could contribute that back to the Log4j-sandbox project!


Jake

Tuesday, February 25, 2003, 1:48:51 PM, you wrote:

CJ An answer to this question/problem is very important to my project group so
CJ please take time to read and understand it.  Thanks.  I struggled with
CJ posting this to a JBOSS group but decided it was more of an issue with the
CJ use of Log4J and not so much how JBOSS was using it.

 

CJ I am using JBOSS and am attempting to define application independent logging
CJ using Log4J.

CJ JBOSS uses Log4J for their logging as well, which is where my problems
CJ begin.

 

CJ If I use the PropertyConfigurator to configure log4J using an application
CJ specific config file.  Its settings conflict with the JBOSS logging.  My
CJ first attempt was defining the root and file appenders for the root logger
CJ which is probably what was throwing the Log4J logging into a loop.

 

CJ My solution was to define a category and log to that vs. getting the logger
CJ and logging to it.

 

CJ The results were encouraging but problematic as well.  My error, debug, info
CJ messages are showing up in the JBOSS console log just fine, but are appended
CJ to an [INFO] message from the JBOSS (log4j) logging.  So it appears that
CJ every message logged to my category is getting appended to a JBOSS log
CJ message (in this case INFO priority) before being logged to the console or
CJ file.

 

CJ How can I define my application specific logging so it can coexist with the
CJ logging configuration defined by the app server which uses log4J but be
CJ independent.  I do not want to have to modify the log4J configuration that
CJ is setup by the JBOSS server implementation.  I want to be able to configure
CJ my own configuration file, load it with a console and file appenders that
CJ coexist with the ones in the JBOSS specific log4J configuration but do not
CJ conflict with the root ones defined.  HOW?

 

CJ Below is a snapshot of my application log4j configuration file that I am
CJ loading.  The JBOSS log4j configuration appears to define a console and file
CJ appender for the root logger.  This configuration works with the caveat that
CJ any logging to this category gets appended to the JBOSS log text before
CJ being displayed to the console or log file.

 

CJ ## The server.log file appender for LightSpeed

CJ log4j.category.LightSpeed=, LightSpeed_Console, LightSpeed_Default

CJ log4j.appender.LightSpeed_Default=org.apache.log4j.RollingFileAppender

CJ log4j.appender.LightSpeed_Default.File=server.log

CJ log4j.appender.LightSpeed_Default.MaxFileSize=500KB

CJ log4j.appender.LightSpeed_Default.MaxBackupIndex=1

CJ log4j.appender.LightSpeed_Default.layout=org.apache.log4j.PatternLayout

CJ 

Re: Remote control

2003-02-18 Thread Jacob Kjome

In addition, check out the ConfigurationServlet in the 
org.apache.log4j.servlet package in log4j-sandbox (CVS only).  I haven't 
tried it yet, but it should provide you with a way to modify your log4j 
settings via the web.

Jake

At 10:55 AM 2/18/2003 +0100, you wrote:
On Tue, 18 Feb 2003 10:49:38 +0100, Oscar Ruiz wrote:

Hi all,

is there any way of changing logging properties online?, i.e. without
restarting the application?, and even more, can this be done remotely?

I have a server with multiple java applications, each of them using its own
logging properties file, when a problem ocurrs i need to change the
properties file in order to enable debuging for the application causing the
problems, but obviously restarting changes the whole state of the
application, not helping to debug.

Use
PropertyConfigurator.configureAndWatch(config/logging.properties);.
This makes log4j reread the properties file every minute, allowing you
to update the debug level online.




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



Re:Real-time configuration for a bean inside application server

2003-02-03 Thread Jacob Kjome

What exactly isn't getting recognized?  What are you changing?  The only 
thing that I know can be done using configureAndWatch is to add 
loggers.  Someone please correct me if I am wrong here.  So, you can add 
them, but removing them from the properties file will not cause a 
particular logger from being removed from the logger Hierarchy.  The only 
way to remove them from there is programatically.  configureAndWatch() is 
pretty limited.

Jake

At 12:41 PM 2/3/2003 +0100, you wrote:
Hi everybody,
unfortunately nobody answered me at my previous mail (shown below) about 
logging for a bean.

Now, I 'm wondering whether I did not receive any answer because mine is a 
complicated problem that nobody has already investigated, or I'm following 
a completely wrong way or I haven't been able to explain my problem 
properly or something else.

What's the reason, please?  :-)

Thanks in advance,
best regards,
Alessio

___
Hi everybody,
I'm trying to have a bean inside the application server be able to log, 
with
the possibility to change at run-time the configuration, by changing the
log4j.properties.

My bean has the following initialization:
PropertyConfigurator.configureAndWatch(log4j.properties,5000);

In this way every time the bean is invoked I'm sure the configuration file
(log4j.properties, which is inside the classpath of the application server)
is read.

The problem is that currently, the bean is able to log, but if I change
something (i.e. the file where to write the log) in the lo4j.properties,
this change is not recognized.

For your information, I add my log4j.properties: be aware that I've 
added my
own new level, and for this reason I added the following classes (which are
similar to the homonym classes inside the downloaded log4j-1.2.7.zip file):
-MyLogger
-MyLoggerFactory
-MyLogLevel

Is maybe wrong the bean initialization (I did it for a servlet and worked)?
Or maybe the log4j.properties file?

Any suggestion is really really appreciated.
Thank you very much in advance.

Bye
Alessio
[EMAIL PROTECTED]


_
log4j.loggerFactory=com.mylog.MyLoggerFactory

log4j.category.com.primo.al.PRIMOBean=DEBUG, dest2


#dest2
log4j.appender.dest2=org.apache.log4j.RollingFileAppender
log4j.appender.dest2.Threshold=INFO
log4j.appender.dest2.File=E:/temp/log4j.log
log4j.appender.dest2.Append=true
log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
log4j.appender.dest2.layout.ConversionPattern=[%d{-MMM-dd
hh:mm},%6.6r]%-5p[%t]%x(%F:%L) - %m%n
log4j.appender.dest2.MaxFileSize=100KB
log4j.appender.dest2.MaxBackupIndex=2

_
Comunica le tue emozioni in tempo reale con MSN Messenger!
http://messenger.msn.it





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


Re: log4j writing to ServletContext.log()

2003-01-17 Thread Jacob Kjome
Hello Bill,

Sounds interesting.  Can you post it along with instructions on use?
I'd like to try it.

Jake

Friday, January 17, 2003, 12:30:32 PM, you wrote:

BS To get around the problems I was having with log4j in a clustered
BS environment (multiple processes on one filesystem), I wrote a new appender
BS that writes to the servlet log as if you called servletContext.log(...).
BS Has anyone thought of doing this before?  Hadn't seen much on the lists
BS about it.  I can submit the code if anyone is interested.

BS The catch is, somehow you have to initialize the appender with the
BS ServletContext objcet.  I arrived at a method static public void
BS setServletContext.  Since we're already initializing log4j from a
BS ServletContextListener, it's fairly trivial to call
BS ServletLogAppender.setServletContext(...) from the context listener
BS immediately after initializing log4j.

BS [[Speaking of which, it might be nice to have a standard log4j context
BS loader that you can just dump into web.xml and point at a properties file.
BS We've implemented one trivially, but I'm sure lots of other folks already
BS rolled their own too.]]

BS Benefits: only one log file to worry about rolling and archiving; log4j
BS events go right alongside app server events; and the app server should take
BS responsibility for synchronizing writes or separating logs by process.

BS Problems: Assumes a one-to-one mapping between classloaders and servlet
BS contexts.  It won't work inside EJBs, since EJBs are in a different
BS classloader.

BS The JMSAppender is the real long-term solution, although that requires
BS someone to be listening for and recording the messages.  But a
BS ServletLogAppender will work nicely in a cluster of pure (non-EJB-ified)
BS webapps.

BS -- Bill


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



-- 
Best regards,
 Jacobmailto:[EMAIL PROTECTED]


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




RE: log4j in an application server

2003-01-15 Thread Jacob Kjome

Also look at this post I made to the log4j-dev list yesterday.  It includes 
an attachment which implements Ceki's ideas about using a custom repository 
selector.  I've only tested it on Tomcat and you'd have to see if it would 
work on Weblogic.  I'd like to hear about any results you get from trying 
it out on Weblogic.  That way I can make improvements.

http://marc.theaimsgroup.com/?l=log4j-devm=104259199601135w=2

All of the submitted code was developed for the Barracuda project ( 
http://barracudamvc.org/ ), however, the ContextClassLoaderSelector being 
used is also in the Log4j-1.3 CVS.  I will be updating that with some 
documentation and submitting the Log4jInit servlet and the 
Log4jApplicationWatch servlet context listener as well.  See Usage.txt in 
the zip file for instructions.

Let me know what you think.

Jake

At 09:23 AM 1/15/2003 -0500, you wrote:


You may want to refer to:
http://qos.ch/logging/sc.html
Tons of great information here pertaining to your question.


-Original Message-
From: alan greenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 14, 2003 5:17 PM
To: [EMAIL PROTECTED]
Subject: log4j in an application server


I want to use Log4j in a Weblogic application server
that will be running many different servlet based
applications. Do I need to initialize Log4j for each
application or should I initialize it once for the
entire application server?

=
Alan Greenberg
ObjectWorks, Inc.
[EMAIL PROTECTED]
[EMAIL PROTECTED]

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

---
This message and any included attachments are from Siemens Medical Solutions
Health Services Corporation and are intended only for the addressee(s).
The information contained herein may include trade secrets or privileged or
otherwise confidential information.  Unauthorized review, forwarding, 
printing,
copying, distributing, or using such information is strictly prohibited 
and may
be unlawful.  If you received this message in error, or have reason to 
believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to [EMAIL PROTECTED]  Thank you

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


RE: Resin with log4j (long)

2002-12-13 Thread Jacob Kjome



Hi Mark,
I have tried using a servlet context listener in Tomcat and it behaves
just as Yoav says it does. The contextInitialized() gets called
first and then an initialization servlet which I have set to
load-on-startup1/load-on-startup gets run. So, at
least Tomcat works this way. I wonder if you are using an older
version of Resin than the version where Yoav inspected the 
code?
One thing I might be in disagreement with Yoav is that I don't think the
SRV 10.2.2 section make it perfectly clear that the contextInitialized()
gets run before servlet init() methods. It leads you to assume that
the contextInitialized() will get called before the servlet's init()
method, but does not say so explicitly. 
SRV 10.3.3 does say something more explicitly about this
The web container
creates an instance of each listener class and registers it for
event
notifications prior to the processing of the first request by the
application. The web
container registers the listener instances according to the interfaces
they implement
and the order in which they appear in the deployment descriptor. During
web
application execution listeners are invoked in the order of their
registration.
However, all that says it that the contextInitialized() method for all
servlet context listeners finishes before accepting the first
request. I define request as a called to service() or,
more commonly, doGet(), doPost(), etc Calling a servlet's
init() method is *not* a request, per-say. So, I think
it is possible that a container implementor might interperet the spec to
say that service() can't be called before contextInitialized() is done
but they might not put any constraint on init() not being called until
contextInitialized() is done. I think that would be a bad
interperetation of the spec but technically legitimate,
nevertheless.
Yoav, any comments about that?
BTW, here is a nice Listener class which provides some useful debugging
for checking on the loading order of these things. I didn't write
it. I was posted to the Tomcat list. I think it will be
useful, though. See attached zip file.

Jake
At 09:37 PM 12/12/2002 -0800, you wrote:
Yoav  Jacob,
 Are you sure about that?
 
 Positive. The example in SRV 10.2.2 makes this clear.
I've also
 inspected the code in tomcat and resin myself and they both
implement
 the spec the same way.
 
 contextInitialized() get called when everything has gotten
done
 initializing. That is, the webapp is now ready to
run. So, 
 in effect,
 a
 servlet with load-on-startup1/load-on-startup
will get called
 *before*
 the contextInitialized() method gets called because until 
 that servlet
 completes the init(), the webapp is *not* initialized.
 
 No. Any servlet init() methods are called after
contextInitialized().
I created a ServletContextListener that initializes log4j in
contextInitialized() and shuts it down in the contextDestroyed(). I
also
have a basic servlet that calls log4j in the init() method (but does not
do
any initialization).
I deploy these in resin 2.1.6 with the following web.xml
snippet:
 context-param

param-nametrace-configuration-file/param-name

param-valueWEB-INF/log4j-configuration.xml/param-value
 /context-param
 
 listener
 listener-class

com.bevocal.application.platform.trace.log4j.Log4jServletContextListener
 /listener-class
 /listener
 
 !-- trace configuration servlet --
 servlet

servlet-nametrace/servlet-name

servlet-classcom.bevocal.application.platform.trace.log4j.Log4jConfigServl
et/servlet-class

load-on-startup1/load-on-startup
 /servlet
The behavior I am seeing is the servlet init method appears to get
called
(and I get a log4j not initialized error message) and THEN
the
ServletContextListern contextInitialized() method gets called. If I
remove
the load-on-startup element, then I do not get the log4j not
initialized,
the contextInitialized() method is called, and when I access the
servlet
then it's init method outputs a proper log message.
I don't know if this behavior is specific to resin or configurable
within
resin, but not the behavior I am expecting given the previous discussion
on
this thread. So, did I miss something critical here? It does
not appear
that contextInitialized() is called before servlet init() methods if
they
are configured to load on startup. At least in resin. Can
someone try this
in Tomcat?
-Mark
--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



TestListener.zip
Description: Zip archive
--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: Resin with log4j (long)

2002-12-13 Thread Jacob Kjome

Duly noted.  thanks for the clarification!

Jake

At 10:32 AM 12/13/2002 -0500, you wrote:

Howdy,

Yoav, any comments about that?

You must not have gotten my reply before posting yours ;)  Or the other
way around: our mail server has been having difficulties ;)

I agree with you SRV 2.3 is not perfectly clear on this point.  SRV 2.4
does clarify things.  contextInitialized() will get called before any
servlets are initialized.  See SRV 2.4 Javadoc for
ServletContextListener available from java.sun.com.

Tomcat's current implementation is fine.  Resin will need to change.

Yoav Shapira
Millennium ChemInformatics



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



RE: Re[2]: Log4j Configuration with Servlet

2002-12-13 Thread Jacob Kjome

Yep,

There is no harm in using Log4j within WEB-INF/lib even if Log4j exists in 
a parent classloader.  It doesn't affect any other apps the the current app 
is free to use whatever version of the jars they want.  In the context of 
using a repository selector, putting log4j.jar in the
WEB-INF/lib is really of little use since it even the default logger 
repository will be unique to that application only.  I just wanted to point 
out that the custom repository selector, if used by the webapp's 
configuration, must be in the same location as the log4j.jar and if the 
log4j.jar is included in WEB-INF/lib, then so must the custom repository 
selector otherwise you run into weird classloading errors.

So, put log4j in WEB-INF/lib or in a parent classloader.  Whatever.  Just 
be diligent about taking jar dependencies into account.

Jake

At 10:35 AM 12/13/2002 -0500, you wrote:
Howdy,

That's a good point. At some point in time, it should be documented
that any container should have one and only once copy of
log4j.jar+associates. Once the selector approach is adopted, putting
log4j.jar in WEB-INF/lib must be strongly discouraged.

I agree with the first part, not the second.  In my experience, the case
of one webapp per container is common (not to mention recommended by
some people, for security and other considerations).

In that case, I'd say it's not only fine but a good idea to put the
log4j core and any optional modules in /WEB-INF/lib.  If you're
deploying your app in a .war file to heterogeneous servers, this is
easier and more portable than putting the log4j files in the
(non-standard) common library location in each server.

Yoav Shapira
Millennium ChemInformatics

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



Re[2]: Log4j Configuration with Servlet

2002-12-12 Thread Jacob Kjome
Hello Mark,

See comments below...

Thursday, December 12, 2002, 12:47:53 PM, you wrote:

MW Jacob Kjome has pointed us at his log4j init servlet in the past.  It is
MW really quite full featured and definitely worth taking a look.

MW http://marc.theaimsgroup.com/?l=log4j-devm=103725695000410w=2

MW Yoav's point about using the context listeners (requiring Servlet 2.3) is
MW very valid, and going forward it is a cleaner way to init/shutdown log4j in
MW the web application context.  If Jacob has not already done it, it might be
MW useful to break out the relevant portions of his servlet into context
MW listeners.  But I'll leave that for him to comment.

Actually, If you look in my post, I mention more than just the
Log4jInit servlet.  I also mention a servlet context listener (SCL) called
Log4jApplicationWatch.  I actually use that currently to do cleanup
such as shutting down loggers and appenders of the currently used
logger repository inside contenxtDestroyed().

Now, I could move the initialization code from the init() of the
Log4jInit servlet to the contextInitialized() method in
Log4jApplicationWatch.  However, that would preclude using this type
of initialization in a servlet-2.2 container.  However, I definitely
think that using contextInitialized() is the way to go if you are
assured that the container supports servlet-2.3.

MW I would also like to say that I have proposed that we include servlet/web
MW application support in v1.3 of log4j.  This would include an init servlet,
MW context listeners, configuration via a servlet, etc.  Jacob has proposed to
MW include his servlet as a start (hintMaybe Jacob would like to lead the
MW effort.../hint).  If anyone has other ideas/submissions, we'd like to hear
MW about them.  We want to make log4j as useful as possible out of the box so
MW that folks don't have to re-invent the wheel each time.

Actually, the main thing I'd propose is having Log4jCRS (Log4j
Contextual Repository Selector) be included with the Log4j
distribution.  The reasons for this are described in my post that Mark
linked to above.

Currently, the way that Log4jCRS works, the classes
that are invoking it must be loaded via the WebappClassloader because
each logger repository is keyed on the classloader.  So, including the
Log4jInit servlet and Log4jApplicationWatch SCL in log4j.jar would not
work because Log4j needs to have the flexibility to be in the
WebappClassloader or a parent classloader.  The only requirement for
Log4jCRS is that it is in the same classloader as Log4j.jar so
including it there would be ideal.  Right now in the Barracuda
project, we separate out Log4jCRS into its own jar which we move
around to wherever the log4j.jar exists.  If log4j.jar exists in
WEB-INF/lib then the jar containing Log4jCRS *must* be there also.  If
log4j.jar exists in a parent classloader (such as common/lib) then the
jar containing Log4jCRS *cannot* be in WEB-INF/lib because log4j won't
be able to load Log4jCRS because although the WebappClassloader can
see the parent classloaders, the converse is not true.  Since Log4jCRS is registered 
as the
repostory selector (replacing the default one), log4j.jar must be able communicate 
with Log4jCRS.
Given this dependency, it make complete sense to include Log4jCRS in
log4j.jar.

Hopefully that was somewhat clear.  Log4jInit and
Log4jApplicationWatch need to be in a separate jar which is included
in each app's WEB-INF/lib.  I have added all the magic I can to make
this work reasonably well.  If Ceki or you (Mark) can figure out a way
where Log4jCRS can work without Log4jInit and Log4jApplicationWatch
existing in each app's WEB-INF/lib, then they can be included in the
log4j.jar.  Otherwise, I'd recommend building a second jar for them or
including them as mere examples for how to configure log4 in a webapp, but not
include them in the core of Log4j (ie, don't include them in
log4j.jar).

So, Ceki, Mark, do you have any ideas for improving upon the
flexibility of Log4jCRS?  If you provide the suggestions, I'll
definitely try to implement those suggestions and drive this thing as
you were hoping.  However, I'll need some code review to let me know
where things could be more optimized, made more flexible, and conform
to the standards of the classes included in Log4j.

later,

Jake

MW -Mark

 -Original Message-
 From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 12, 2002 5:50 AM
 To: Log4J Users List
 Subject: RE: Log4j Configuration with Servlet
 
 
 Howdy,
 While Mr. (?) Lenharcik's suggestion will work, I'd suggest doing it
 slightly differently: use a ServletContextListener and 
 initialize log4j
 in the contextInitialized() method.  That will get called before any
 servlet's init() method.  And the contextDestroyed() method of that
 listener is a great place to shut down log4j gracefully
 (LogManager.shutdown()).  The container is free to unload and 
 reload any
 servlet, including load-on-startup servlets, at any

Re[4]: Log4j Configuration with Servlet

2002-12-12 Thread Jacob Kjome
MW Jacob, do you think you can make an official apache submission (with all
MW the correct apache headers, etc)?

Is there some place that describes all that, or should I just copy the
license from some other Log4j file and paste it into Log4jCRS?

Jake


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




Re[6]: Log4j Configuration with Servlet

2002-12-12 Thread Jacob Kjome
Hello Mark,

One more question.  What package might it exist in?  My best guess
would be org.apache.log4j.spi?  I'll assume that unless you tell me
differently.

Jake

Thursday, December 12, 2002, 3:53:38 PM, you wrote:

MW I'm sure there is, but I think any log4j source file will provide enough
MW example.  It is basically just the license header info at the top, AFAIK.

MW -Mark

 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 12, 2002 1:48 PM
 To: Log4J Users List
 Subject: Re[4]: Log4j Configuration with Servlet
 
 
 MW Jacob, do you think you can make an official apache 
 submission (with all
 MW the correct apache headers, etc)?
 
 Is there some place that describes all that, or should I just copy the
 license from some other Log4j file and paste it into Log4jCRS?
 
 Jake
 
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 

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



-- 
Best regards,
 Jacobmailto:[EMAIL PROTECTED]


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




Re[6]: Log4j Configuration with Servlet

2002-12-12 Thread Jacob Kjome
Hello Mark,

Here it is (zip file attached).

I set the package as org.apache.log4j.spi and commented out the
imports from that package.  If it is going to a separate package, feel
free to modify it.

Jake

Thursday, December 12, 2002, 3:53:38 PM, you wrote:

MW I'm sure there is, but I think any log4j source file will provide enough
MW example.  It is basically just the license header info at the top, AFAIK.

MW -Mark

 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 12, 2002 1:48 PM
 To: Log4J Users List
 Subject: Re[4]: Log4j Configuration with Servlet
 
 
 MW Jacob, do you think you can make an official apache 
 submission (with all
 MW the correct apache headers, etc)?
 
 Is there some place that describes all that, or should I just copy the
 license from some other Log4j file and paste it into Log4jCRS?
 
 Jake
 
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 

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



-- 
Best regards,
 Jacobmailto:[EMAIL PROTECTED]


Log4jCRS.zip
Description: Zip compressed data
--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re[2]: Log4j Configuration with Servlet

2002-12-12 Thread Jacob Kjome

Hi Ceki,

see comments inline below...

At 12:45 AM 12/13/2002 +0100, you wrote:

At 15:05 12.12.2002 -0600, Jacob Kjome wrote:

Hello Mark,

MW I would also like to say that I have proposed that we include servlet/web
MW application support in v1.3 of log4j.  This would include an init 
servlet,
MW context listeners, configuration via a servlet, etc.  Jacob has 
proposed to
MW include his servlet as a start (hintMaybe Jacob would like to lead the
MW effort.../hint).  If anyone has other ideas/submissions, we'd like 
to hear
MW about them.  We want to make log4j as useful as possible out of the 
box so
MW that folks don't have to re-invent the wheel each time.

+1


Does that mean an init servlet in general or the one I created?



Actually, the main thing I'd propose is having Log4jCRS (Log4j
Contextual Repository Selector) be included with the Log4j
distribution.  The reasons for this are described in my post that Mark
linked to above.

Currently, the way that Log4jCRS works, the classes
that are invoking it must be loaded via the WebappClassloader because
each logger repository is keyed on the classloader.  So, including the
Log4jInit servlet and Log4jApplicationWatch SCL in log4j.jar would not
work because Log4j needs to have the flexibility to be in the
WebappClassloader or a parent classloader.  The only requirement for
Log4jCRS is that it is in the same classloader as Log4j.jar so
including it there would be ideal.  Right now in the Barracuda
project, we separate out Log4jCRS into its own jar which we move
around to wherever the log4j.jar exists.  If log4j.jar exists in
WEB-INF/lib then the jar containing Log4jCRS *must* be there also.  If
log4j.jar exists in a parent classloader (such as common/lib) then the
jar containing Log4jCRS *cannot* be in WEB-INF/lib because log4j won't
be able to load Log4jCRS because although the WebappClassloader can
see the parent classloaders, the converse is not true.  Since Log4jCRS is 
registered as the
repostory selector (replacing the default one), log4j.jar must be able 
communicate with Log4jCRS.
Given this dependency, it make complete sense to include Log4jCRS in
log4j.jar.


Just to make sure I understand, Log4jCRS and log4j.jar must be
mutually accessible. Thus, you have to put Log4jCRS.jar where
log4j.jar is, and vice versa. Is that a problem apart from being
cumbersome? Is there any other problem? (Again I am trying to make
sure I understand correctly.)


Yep, exactly.  It is cumbersome and confusing for developers not used to 
dealing with classloader issues.  If they can't see each other then the 
configuration breaks.  If Log4jCRS was included in log4j.jar, then there 
wouldn't be any chance that a user could mess this up.


Hopefully that was somewhat clear.  Log4jInit and
Log4jApplicationWatch need to be in a separate jar which is included
in each app's WEB-INF/lib.  I have added all the magic I can to make
this work reasonably well.  If Ceki or you (Mark) can figure out a way
where Log4jCRS can work without Log4jInit and Log4jApplicationWatch
existing in each app's WEB-INF/lib, then they can be included in the
log4j.jar.  Otherwise, I'd recommend building a second jar for them or
including them as mere examples for how to configure log4 in a webapp, 
but not
include them in the core of Log4j (ie, don't include them in
log4j.jar).

So, Ceki, Mark, do you have any ideas for improving upon the
flexibility of Log4jCRS?  If you provide the suggestions, I'll
definitely try to implement those suggestions and drive this thing as
you were hoping.  However, I'll need some code review to let me know
where things could be more optimized, made more flexible, and conform
to the standards of the classes included in Log4j.


The classloader based approach has one severe limitation. Without
explicit Container support, it kinda breaks down for applications with
multiple classloaders. For example, in an EJB applicaiton, beans have
their own classloader, web-applications have another class loader, and
JSPs have yet another even if they all live in the same application
(EAR file). See the problem?


Now, when you say explicit container support, are you saying that it 
would have to be implemented by the container or do you just mean that it 
depends on the behavior of the container.  In the case of Log4jCRS, the 
container does not need to know about it at all.  The only way it is 
connected to the container is that Log4jCRS assumes that the classloaders 
are implemented a certain way.  As of right now, Log4jCRS has been tested 
to work with Tomcat-4.1.x standalone (should work fine in 4.0.x as 
well).  Since Tomcat is not an EJB container, EJB's are not a consideration 
and niether Log4jCRS not log4j.jar would see the EJB container at all even 
if there was some connection being made between Tomcat and an EJB container 
because they'd be in separate JVM's.  You'd have two separate logger 
configurations anyway in this case.

The big exception would be a case

RE: Resin with log4j (long)

2002-12-05 Thread Jacob Kjome

Hi Yoav,

Are you sure about that?

contextInitialized() get called when everything has gotten done 
initializing.  That is, the webapp is now ready to run.  So, in effect, a 
servlet with load-on-startup1/load-on-startup will get called *before* 
the contextInitialized() method gets called because until that servlet 
completes the init(), the webapp is *not* initialized.

ServletContextListener's contextInitialized() and contextDestroyed() 
methods are notified at the *end* of each process of startup and shutdown, 
respectively.  So, this only works for you if you don't use log4j in 
servlets which load on startup.  The only way to guarantee this is to use a 
servlet which loads on startup and make that servlet have 
load-on-startup1/load-on-startup and give other servlets that load on 
startup numbers that are higher than 1.  This will guarantee that Log4j 
will be configured and available for all other resources in the 
application.  I'm making one assumption here that I'm not sure I can 
make.  I am assuming that each init() method must complete before the next 
servlet's init() method gets called.  If that assumption is false, then all 
bets are off.  However, in practice, I've never had a problem so far with 
this issue.

The contextDestroyed(), on the other hand, is a fine place to do any log4j 
cleanup such as calling LogManager.shutdown() to release any locks on Files 
if you were using, for instance, when using a FileAppender.



Jake

At 03:45 PM 12/5/2002 -0500, you wrote:
Hi,
Consider moving the log4j initialization from a startup servlet to a
ServletContextListener's contextInitialized() method.  That's guaranteed
to be the first thing in your webapp that's called by the server.
Before any init() methods.  And then you don't need to worry about the
possibility of a load-on-startup servlet being destroyed and reloaded by
the container (which can happen: the container is free to do this at any
time).

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Peter Lindquist [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 3:37 PM
To: Log4J Users List
Subject: Re: Resin with log4j (long)

Thank you Rick..

Log4j was being initialized in the startup servlet's init method, but
it
wasn't technically the -first- thing that was done. Neither of the two
preceding operations used log4j, but obviously those classes must have
created something that does.. because the errors went away when I
bumped up
the log4j initialization to be the first thing in the init() method.


- Original Message -
From: Morris, Rick [EMAIL PROTECTED]
To: 'Log4J Users List' [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 1:50 PM
Subject: RE: Resin with log4j (long)


We had this problem for a while until we realized that the log4j
initializer
servlet needed to be started first. If you are using a servlet to
initialize
log4j, just make sure it is loaded before anything that uses log4j and
you
should be fine.

-Original Message-
From: Peter Lindquist [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 2:53 PM
To: [EMAIL PROTECTED]
Subject: Resin with log4j (long)


I've researched this a fair amount.. any input or suggested new
directions
would be most appreciated.

Problem: Resin starts with log4j warnings (Win2k and/or linux)

Resin 2.1.5 (built Fri Oct  4 12:10:31 PDT 2002)
Copyright(c) 1998-2002 Caucho Technology.  All rights reserved.

Starting Resin on Thu, 05 Dec 2002 12:29:43 -0600 (CST)
log4j:WARN No appenders could be found for logger (root).
log4j:WARN Please initialize the log4j system properly.


Here's what I've got.

I'm using an xml config file and the DOMConfigurator class for loading
it.
The root logger has an appender assigned to it and the config file IS
being
read. After these warnings are generated, log4j proceeds to load and
log
messages according to my config file. Updating the file results in
immediate
new behavior.

I turned on debugging for log4j (log4j:configuration debug=true)
and
received the following console messages AFTER the warnings presented
above..
which means the warnings were printed before the config file had even
been
read. I've reduced the output to what seemed relevant, as the whole
thing
is
a bit too much for the eyes.


configFileName: C:/home/HEAD/Properties/logging.xml
log4j: Threshold =null.
log4j: Retreiving an instance of org.apache.log4j.Logger.
. . .
log4j: Level value for root is  [DEBUG].
log4j: Desired Level sub-class: [util.PinLogLevels]
log4j: root level set to DEBUG
log4j: Adding appender named [MainLog] to category [root].
http listening to *:80


The relevant parts of my config file:

log4j:configuration debug=true
 appender name=MainLog class=org.apache.log4j.RollingFileAppender
  param name=file value=C:/home/HEAD/logs/pinpoint.log/
  param name=append value=true/
  param name=MaxFileSize value=10MB/
  param name=MaxBackupIndex value=10/
  layout class=org.apache.log4j.PatternLayout
   param 

Re[2]: Multiple Log4J instances in one VM

2002-12-03 Thread Jacob Kjome
Hello sanjayrajsoni,

Logging with separate logger repositories (hierarchies) using a logger repository
selector is log4j's way of dealing with this.  It works quite nicely,
if you ask me.  It allows you to configure each individual logger
repository without treading on any other.  See Ceki's doc here:
http://qos.ch/containers/

There he describes logger repositories keyed on classloader which
works fantastically in servers like Tomcat-4.1.xx.  For other servers
such as Jboss which, apparently, uses a common classloader for the
whole server (am I right about that?), this method might not work
quite right.  However, you can create a custom logger repository
selector to key on anything you want.

It would be nice if Log4j could come up with a standard repository
selector that worked in a standard way in all environments.  That's
probably what people are looking for.

Jake

Tuesday, December 03, 2002, 1:01:35 PM, you wrote:

s We also ran into the same issue and is causing many headaches 
s prompting some team-members to insist that we get rid of Log4J. Log4J 
s being open-source is used by different teams/companies who have no 
s cooridnation between them. I hope in the future releases this problem 
s can be solved.

s --- In [EMAIL PROTECTED], Thomas Muller [EMAIL PROTECTED] wrote:
 Log4j's somewhat static configuration approach strikes me as quite
 non-object-oriented since it in many ways violates encapsulation and
 instantiation; a natural requirement for a logging API is that 
s different
 parts of a program (running in the same VM) should be able to 
s configure
 their own instances of Log4j independent of eachother, e.g. they 
s should
 not need to ask eachother or the API itself whether it's configured.
 
 Everything considered, it seems like getting Log4j to work smoothly 
s (as is)
 in a multiple configuration environemt is a cumbersome and 
s unintuitive task,
 and clearly needs to be addressed in later versions.
 
 --
 
 Thomas
 
 
  | -Original Message-
  | From: Ceki Gulcu [mailto:ceki@q...]
  | Sent: 07 August 2002 09:17
  | To: Log4J Users List
  | Subject: RE: Multiple Log4J instances in one VM
  |
  |
  |
  | Hmm, that is not it either. I was thinking of simply checking 
s whether
  | log4j is already configured. If a component detects that log4j is
  | configured, it should not configure log4j.
  |
  | Here is a more elaborate explanation:
  |
  | http://marc.theaimsgroup.com/?l=log4j-userm=102775658930710w=2
  |
  |
  | At 09:01 07.08.2002 +0100, you wrote:
  | As Ceki points out, there are other ways of solving this, e.g. 
s by using
  | different hierarchies for the different programs.
  | 
  | See e.g. org.apache.log4j.net.SocketServer for an example of
  | how to obtain
  | this.
  | 
  | --
  | 
  | Thomas
  | 
  | 
  | 
  |   | -Original Message-
  |   | From: Thomas Muller [mailto:ttm@o...]
  |   | Sent: 07 August 2002 08:22
  |   | To: Log4J Users List
  |   | Subject: RE: Multiple Log4J instances in one VM
  |   |
  |   |
  |   |
  |   |
  |   |  | -Original Message-
  |   |  | From: Hitzbleck, Andreas (ext. Mitarbeiter)
  |   |  | [mailto:Andreas.Hitzbleck@K...]
  |   |  | Sent: 07 August 2002 08:18
  |   |  | To: '[EMAIL PROTECTED]'
  |   |  | Subject: Multiple Log4J instances in one VM
  |   |  |
  |   |  |
  |   |  | Hello list,
  |   |  |
  |   |  | I am developing a java program which is integrated in a
  | big content
  |   |  | management system. Thus, our code runs with some other
  | java programs
  |   |  | developed by other companies in one virtual mashine.
  |   |  |
  |   |  | Unfortunately, the Log4J initialization of one program 
s of another
  |   |  | company overwrites our Log4J configuration or - if we 
s start up
  |   |  | our program later - vice versa. I think that is because 
s of the
  |   |  | statically implementation(s) of the configure() methods 
s in
  |   |  | Property- Basic- and DOMConfigurator?
  |   |  |
  |   |  | Is there a way to solve this problem or to work around 
s it? Would
  |   |  | it help to implement my own classloader and load the
  | Log4J classes
  |   |  | through this loader?
  |   |
  |   | Yes - different classloaders can utilize different log4j
  | libraries and
  |   | configurations.
  |   |
  |   | --
  |   |
  |   | Thomas
  |   |
  |   |
  |   |
  |   |
  |   |
  |   |
  |   |
  | 
s **
s ***
  |   | Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All 
s rights
  |   | reserved.
  |   | The information supplied in this email should be treated in
  | confidence.
  |   | No liability whatsoever is accepted for any loss or damage
  |   | suffered as a result of accessing this message or any 
s attachments.
  |   |
  |   |
  | 
s __
s __
  |   | This email has been scanned for all viruses by the
  | MessageLabs SkyScan
  |   | service. For more information on 

  1   2   >