[MOVING] Log4j lists moving shortly!

2003-12-20 Thread Ceki Gülcü
Hello all,

Given the migration of the log4j sub-project from Jakarta to Logging
Services, the [EMAIL PROTECTED] and
[EMAIL PROTECTED] lists are about to be renamed
respectively as [EMAIL PROTECTED] and
[EMAIL PROTECTED] The [EMAIL PROTECTED] lists will cease to
exists in a few hours.
Subscribers to the old lists will be automatically migrated to the new
lists. Please kindly update your references to the new lists.
Best regards,

--
Ceki Gülcü
 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]


Migration to logging.apache.org

2003-12-19 Thread Ceki Gülcü
Hello,

This is just to inform you that subsequent to the creation of the
Apache Logging Services project, the existing log4j-dev and log4j-user
lists will be migrating to logging.apache.org from
jakarta.apache.org. The migration should be seamless in the sense that
current subscribers will automatically be subscribers of the new
lists.
The migration is expected to occur this weekend or early next week.

--
Ceki Gülcü
 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]


[ANNOUNCEMENT] Apache Logging Services project

2003-12-18 Thread Ceki Gülcü
Good morning to all,

The log4j developers are pleased to announce that the Board of
Directors of the Apache Software Foundation unanimously passed a
resolution for the creation of the Apache Logging Services project. A
copy of the resolution can be found at:
http://nagoya.apache.org/wiki/apachewiki.cgi?LoggingApacheOrg/BoardResoluion

The Logging Services project is intended to provide cross-language
logging services for purposes of application debugging and
auditing. The discussions leading to the submission of this resolution
can be found at:
 http://marc.theaimsgroup.com/?t=10711552621&r=1&w=2

We should also mention that thanks to the relentless efforts of many
developers and in particular those of Scott Deboy, we currently have
inter-operability between the following projects:
 * Log4Cxx (c++)
 * Log4CPlus
 * Log4j
 * Log4Net
 * Log4Perl
 * Log4PHP
 * JDK1.4's util.logging framework
There is still much work ahead bringing in the various projects to
work together within the Logging Services Project. The process is
likely to take a little while. In the mean time, we will continue to
do what we like best, that is developing open source software.
Happy holidays to all,

--
Ceki Gülcü
 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]


Re: Tomcat log4j .

2003-12-17 Thread Ceki Gülcü
At 04:53 PM 12/17/2003 +0530, Antony Paul wrote:
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.
You can close the appender in question. Calling LogManager.shutdown() will 
close down all appenders.

This code can be added to the 
<../../javax/servlet/ServletContextListener.htm#contextDestroyed(javax.servlet.ServletContextEvent)>contextDestroyed(<../../javax/servlet/ServletContextEvent.htm>ServletContextEvent 
sce) method of a

ServletContextListener.

See for example:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg10001.html

Hope this helps,

--
Ceki Gülcü
 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]


Re: Fallback Error Handler

2003-12-17 Thread Ceki Gülcü
Hello Milind,

FallbackErrorHandler was not designed/intended to be sub-classed. Hence, 
the private accessor. If you think there is value in sub-classing 
FallbackErrorHandler we can certainly accomodate your wish. A patch would 
be handy!

I hope this answers your question,

At 06:32 PM 12/17/2003 +0550, Milind Rao wrote:
I need to access the backup appender in the fallback error handler of a 
primary appender, but there is no method to
access it and the appender is package private.  I have subclassed the 
FallbackErrorHandler class to redefine the
setBackupAppender method and added a getBackupAppender method.

But I was curious as to why there isn't a public accessor.  Is what I'm 
doing not advisable?

Regards
Milind
--
Ceki Gülcü
 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]


RE: Dynamic Configuration

2003-12-12 Thread Ceki Gülcü
The following excerpt from "The complete log4j manual" should help
you understand the observed behavior.
Reloading configuration files:

Reloading of a configuration file or reconfiguration of log4j from a
different con-figuration file is allowed. It is also
thread-safe. Contrary to expected behavior, dur-ing reconfiguration,
log4j configurators do not reset the existing configuration. The
rationale behind this somewhat unexpected behavior is to allow
incremental changes to the configuration.
Reconfiguration has obviously some effect on the existing
configuration. In particular, all appenders of any logger explicitly
mentioned in the new configuration will be closed and removed from the
logger. However, loggers which are not mentioned in the new
configuration remain untouched.  All the more, appenders attached to
such loggers remain attached after reconfiguration.  For example, if
an appender is attached to multiple loggers, it is possible for the
appender to be closed during the reconfiguration but remain attached
to a logger not mentioned in the second configuration file. If after
reconfiguration you try to log to this closed appender, log4j will
warn you about trying to log to a closed appender.
At 11:26 AM 12/12/2003 +1100, you wrote:
> Problem 2:
> You mentioned that you get those messages as well sometimes, do you 
know why?

It is possible that there might be some synchronization problem at the
point of the call to a specific appender's close() method, and during
the close, some logs try and come through to be appended.
What type of Appender are you using (FileAppender? Daily*Appender?), and
what version of log4j are you using? (the latest is log4j 1.2.8)
cheers,

Paul Smith
--
Ceki Gülcü
 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]


RE: Log based on object and not the class

2003-12-11 Thread Ceki Gülcü
Scott,

I just committed a possible solution to the problem you raised.
You can look at it here:
http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/examples/objectBased/
Does it solve the problem?

At 08:56 AM 12/11/2003 -0700, you wrote:
I considered doing something like you suggested but I just hate to add code
in order to handle logging.  Our application is very large and I would have
to add some object layers in order to get it to work.  It seems like
overkill.  For now I may just put external filters on my application that
simply display the messages I am interested in.
Thanks for the response.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 11, 2003 8:47 AM
To: Log4J Users List
Subject: Re: Log based on object and not the class
Scott,

Why not add a switch parameter to the parent method?

i.e

Class Parent {
 ...
 Public void myMethod(boolean b) {
 if (b==true) {
  Logger.debug("logging message");
 }
 }
}
Class Child1 extends Parent {
 ...
 Public void execute1() {
 this.myMethod(true);
 }
}
Class Child2 extends Parent {
 ...
 Public void execute2() {
 this.myMethod(false);
 }
}
Steve
--
Ceki Gülcü
 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]


RE: [Chainsaw]: Ant-based installer

2003-12-11 Thread Ceki Gülcü
How about allowing both? Ignoring just the selected node in the tree
(as is the case currently) **or** ignoring the selected node and its
children.
The solution of expressions suggested by Scott offers a far more
precise control but probably is harder to put in place for the user.
Just my 2 shallow cents.

At 10:39 PM 12/10/2003 -0800, Scott Deboy wrote:
I personally would like to see the logger tree stay simple.  Focusing on a 
node implies you can see everything under it - makes sense to me.

NOTE:  the information following applies only to the CVS tip version of 
Chainsaw v2:

If you want to exclude certain packages, why not build an expression in 
the 'focus on' text box?  enter something like this:

! ( ( LOGGER LIKE com.someothercompany.corecomponent.* ) || ( LOGGER ~= 
org.blah ) )

the LIKE operator evaluates regular expressions, the ~= operator performs 
a partial text (case insensitive) match.

the ! and || operators are hopefully obvious.  You can see all of the 
supported operators 
here: 
http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4j/chainsaw/rule/RuleFactory.java?rev=1.6&view=auto

If any of the operators need to evaluate fields that use multiple words, 
wrap the operand in single quotes (like the text of an event).  For example:

! ( MSG ~= 'ignore msgs that contain this phrase' )

Notice how all operands and operators must be separated by spaces (even 
spaces around parens).

Hope this helps, your problem is exactly why we built the expression language.

Take care,
Scott
--
Ceki Gülcü
 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]


Re: Unexpected logger ancestor

2003-12-11 Thread Ceki Gülcü
At 06:06 PM 12/10/2003 +, tom ONeill wrote:
No, absolutely not.

X.Z and Y.Z should bear no relation to each other except their common 
ancestor the 'root' logger.

Does that answer your question?


Thanks for your help Ceki

So you are saying that my "Y.Z" logger should not be created as "X.Y.Z" 
just because I already have a logger "X.Z"?. Therefore what I am seeing is 
some kind of error and not the expected behaviour? If I know it is an 
error I can now go and try find what is causing the problem.
I confirm. It is an error.

My configuration is pretty straightforward so I doubt thats the issue. 
However I am using my own logger implementation (it extends Logger) so 
maybe somthing in there is causing the problem. Perhaps I have overridden 
one of Loggers methods incorrectly..
Hmm, maybe the problem is in your wrapper. Just a cynical thought...

--
Ceki Gülcü
 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]


Re: Config Files

2003-12-10 Thread Ceki Gülcü
As Alison Ortega mentioned, log4j configurators support the substitution of 
system properties, actually properties in general. Quite a handy feature...

At 09:48 AM 12/10/2003 -0500, Alison Ortega wrote:
I do this:



...
and set the java properties - this config is portable btw windows and
solaris.  Is this what you meant?
Alison Ortega
North Carolina State University
ACS
Systems Programmer II
919-513-1417
--
Ceki Gülcü
 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]


Re: Unexpected logger ancestor

2003-12-10 Thread Ceki Gülcü
At 01:32 PM 12/10/2003 +, tom ONeill wrote:
Hi Ceki,

I have been using log4j for a while now and I have read the documentation 
on numerous occasions. I posted my question because the behaviour I 
experienced was not consistent with what I had expected based on my 
intepretation of the documentation (warrented that my interpretation may 
not have been correct).

The documentation states that
"the name of a logger is a case sensitive string of dot seperated words 
and each word in a logger name is said to be an ancestor of the subsequent 
words and a parent of the immediately following word."

"A logger is said to be an ancestor of another logger if its name followed 
by a dot is a prefix of the descendant logger name. A logger is said to be 
a parent of a child logger if there are no ancestors between itself and 
the descendant logger. "

From this I can take it that if I create a logger "X" and then create 
another logger "X.Z" then the logger X is an ancestor of Z. If as I 
outlined in my original question I create a logger "Y" and then a logger 
"Y.Z" then the logger "Y.Z" is actually created as "X.Y.Z". I interpreted 
the line "A logger is said to be an ancestor of another logger if its 
name followed by a dot is a prefix of the descendant logger name"to mean 
that the a logger can only be an ancestor of another logger if its name 
follows by a dot is the immediate prefix of the decendant logger name. 
Thus just because I had originally created a logger X.Z I would not 
expected Y.Z to end up as "X.Y.Z" because "X" followed by a dot is not a 
prefix of the logger name "Y.Z".

However I can now see that by creating a logger "X" and a logger "X.Z" I 
have said that "X" is an ancestor of "Z" and I suppose log4j holds this 
relationship when I create the logger "Y.Z".
No, absolutely not.

X.Z and Y.Z should bear no relation to each other except their common 
ancestor the 'root' logger.

Does that answer your question?

Tom
--
Ceki Gülcü
 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]


Re: Having 2 loggers log to the same file...

2003-12-08 Thread Ceki Gülcü
Can you provide the exception?

At 11:33 AM 12/8/2003 -0800, Alan Brown wrote:
I'd like to have 2 separate parts of my code log to the same file
because they share functionality.  However I'm getting a class cast
exception when I specify the following in my log config file...
log4j.logger.opsx.server.db = DEBUG, A3
log4j.additivity.opsx.server.db = false
log4j.logger.opsx.server.dac.OpsTransaction = DEBUG, A3
log4j.additivity.opsx.server.dac.OpsTransaction = false
log4j.appender.A3=org.apache.log4j.RollingFileAppender
log4j.appender.A3.MaxFileSize=1024KB
log4j.appender.A3.MaxBackupIndex=40
log4j.appender.A3.File=\\opsx\\log\\db\\OpsxConnection.log
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=* %-5p (%x) %d{DATE} %c -
\r\n%m\r\n\r\n
If I comment out lines 3 and 4 then everything works ok with the logging
going to the default logging file.
Am I doing something obviously wrong?

Thanks In Advance.

alan
--
Ceki Gülcü
 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]


Re: improving PropertyConfigurator.configureAndWatch

2003-12-08 Thread Ceki Gülcü
I think that Mark will find this fascinating. I sure do.

At 03:00 PM 12/8/2003 +0100, ROQUES Arnaud - NTR ( 
[EMAIL PROTECTED] ) wrote:
Hi!

log4j is great, but I think that
PropertyConfigurator.configureAndWatch(String configFilename) is not good
enough for
dynamic modification, as you have to wait until the delay so that your
modification are taken into account.
So I imagine a solution: to put a *very* little FTP server in the
application on a particular port (example:2100).
When you put a file on this server, the file is not saved on disk, but sent
to PropertyConfigurator, so that modifications of the configu are taken into
account immediatly. (You can log with any username and password)
(Some text editor have embedded FTP client, so it can be very easy to change
the log4j configuration with them)
I have coded this little FTP server, so if you want to use it, all you have
to do is:
PropertyConfigurator.configure("myconf.properties"); // 
As usually
new FTPServer(2100, "myconf.properties"); // Launch the 
server on the 2100

Note that when you put some files on the FTP server, data are *not* saved to
disk. It's only sent to log4j PropertyConfigurator. (You can also get the
last config from the FTP server).
Please free to improve it, or to integrate it in next version of log4j!

Arnaud Roques

FTPServer.java file:

import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.log4j.*;
public class FTPServer extends Thread
{
ServerSocket server;
ArrayList data;
FTPServer(int port, String fileName) throws Exception
{
data = new ArrayList();
File f = new File(fileName);
BufferedReader br = new BufferedReader(new FileReader(f));
String s;
while ((s=br.readLine())!=null)
data.add(s);
server = new ServerSocket(port);
System.err.println("FTP Server on " +
InetAddress.getLocalHost().getHostAddress()+" "+port);
        start();
}
[cut]
--
Ceki Gülcü
 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]


Re: Unexpected logger ancestor

2003-12-05 Thread Ceki Gülcü
Tom,

Have you made any attempt to read the documentation?

At 11:56 AM 12/1/2003 +, tom ONeill wrote:
Hi all,

I am using log4j 1.2.8 which I have congifured using the XML 
configuration. I have defined four category entires in my log file and I 
have now encountered some unexpected (for me at least) behaviour.

The loggers are configured as follows:


  


  

[cut]


Tom
--
Ceki Gülcü
 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]


RE: Log4j SMTP Appender Tomcat trouble

2003-12-03 Thread Ceki Gülcü
Yoav,

Not exactly. SMTPAppender buffers logging request of all levels. Sending 
will be *triggered* by the arrival of a logging request of level ERROR. 
After the arrival of an error, the existing buffer will be send in an email 
message.

Anyway, you were very much right to mention the dependence of SMTPAppedner 
on logging statements of level ERROR.

At 10:07 AM 12/3/2003 -0500, Shapira, Yoav wrote:
Howdy,
You do know the SMTP appender by default will only send our ERROR and
higher messages, right?
Yoav Shapira
Millennium ChemInformatics
--
Ceki Gülcü
 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]


Re: I am not getting stack trace from logger.error("error",e)?

2003-11-27 Thread Ceki Gülcü


Your invocation of the 'error' method is correct. What are you observing? 
Have you configured log4j?

At 01:40 PM 11/27/2003 -0800, Robert Augustyn wrote:
Hi,
I was expecting that I would get stack trace from following call:
}catch(Exception e){
  logger.error("Error",e);
}
What could possibly be a problem?
Thanks in advance.
robert
--
Ceki Gülcü
 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]


Re: Logging multiple threads to multiple files

2003-11-14 Thread Ceki Gülcü
Not without touching the core of log4j. But it can be done.

At 10:19 AM 11/14/2003 -0800,   wrote:
I'm using log4j 1.2.8. I have a class that starts off 4 other threads. So 
I have 5 threads running, all at the same time. What I would like to do is 
log the 5 threads into their own log files.

The first time I tackled this, I got 5 files with the same output (all 
output from all threads). Then I got it to where the 5 files show 
different things, however, it seems like the threads are stepping over 
each other. thread1 would have a log entry in thread2's log, thread2's log 
will have some entries in thread3's log, and so on.

I've done some poking around and found that I can set a threshhold to log 
specific log levels to different files, but that's not what I need. I want 
to log ALL levels from a thread to its own log file.

Can this even be done?
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Log4J 1.2.8 not functional with J2ME

2003-11-14 Thread Ceki Gülcü
At 10:09 AM 11/14/2003 -0800, Elias Ross wrote:
On Fri, 2003-11-14 at 03:29, Dirk Materlik wrote:
> Hi,
> I am trying to use Log4J with the Sun implementation of the Java 2,
> Micro Edition on the Sharp Zaurus. This used to work without problems,
> however, with 1.2.8 I get a ClassNotFoundException for
> java.beans.Introspector when I try using PropertyConfigurator. This is
> expected behaviour, since java.beans is not part of J2ME. This is rather
> unfortunate since PropertyConfigurator seems to me to be the most basic,
> but useful Configurator available.
>
I would file a bug and write your own PropertyConfigurator.  Since it is
open source, you can cut and paste the source, modify it to work with
J2ME and put it into your own package.  I would create a patch that you
can put into Bugzilla with the bug itself.
Thank you for pointing out the open-source nature of log4j. Of course, the 
clauses of the Apache Software License must be adhered to, in particular 
the first clause.

--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Using log(fqcn,level, message, throwable): how is fqcn displayed in the formatted output?

2003-11-06 Thread Ceki Gülcü
Hello Francis,

The fqcn parameter is only used to correctly extract caller's location 
information (class name, file name, line number). The fqcn parameter is not 
displayed.

HTH.

At 03:24 PM 11/6/2003 +0100, Francis Le Monnier wrote:
If I use log(fqcn,level, message, throwable) to generate a log event, which
% parameter do I use to display the fqcn in my formatted logging event?  No
matter what I pass as fqcn, it appear to display only the logger class when
I use %c, a ? when I use %C and () when I use %l.
So, in the call log("this.is.my.pack", Priority.DEBUG, "my pack message",
null), how do I see "this.is.my.pack" in the output?
Thanks
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: LoggingEvent.locationInfo

2003-11-04 Thread Ceki Gülcü
At 09:16 AM 11/4/2003 +0200, you wrote:
Hi,

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

Here is the getLocationInformation method in LoggingEvent:

  /**
   * Set the location information for this logging event. The collected
   * information is cached for future use.
   */
  public LocationInfo getLocationInformation() {
if (locationInfo == null) {
  locationInfo = new LocationInfo(new Throwable(), fqnOfCategoryClass);
}
return locationInfo;
  }
The new Throwable contains the stack information. It does not need to have 
a message, we are only interested in the stack info. Does that make sense?

Thank you

Andreas Bothner
Systems Integrator
Mobile Telephone Networks - Information Systems
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: MDC values and child threads

2003-10-29 Thread Ceki Gülcü
Yes, because MDC uses a ThreadLocalMap which extends InheritableThreadLocal.

final public class ThreadLocalMap extends InheritableThreadLocal {
  ...
}
At 09:59 AM 10/28/2003 -0500, Lutz Michael wrote:


Is it correct to state that MDC values are automatically carried forward to
child threads?
Thanks in advance.
Mike
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: log4j 1.3 domains, anyone?

2003-10-27 Thread Ceki Gülcü
Hi Doug,

Domains will be presented at ApacheCon 2003. The slides will be available 
after the conference.

At 03:36 PM 10/27/2003 -0500, you wrote:
I was reading the plan page of log4j 1.3 and found this:

Domains: "This is a very powerful and innovative concept that extends the
notion of hierarchical loggers. It will also allow dynamic logging with
pin-point accuracy. It was first suggested to me by Scott Stark of JBoss
fame."
Is there a writeup somewhere or can someone point me to an archived message
that might describe the high level intension of Domains and how they will
fit in the current log4j object world of loggers, appenders, levels,
filters, etc.?
Thanks in advance.

doug
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Log4J vs. java.util.logging

2003-10-27 Thread Ceki Gülcü
Unless I am mistaken, commons-logging was always dynamic. It always used 
classloader tricks to determine which logging API to use.

At 02:26 PM 10/27/2003 +0100, Tbee wrote:
If I read the commons-logging articles correctly, this is exactly how commons-
logging came to be. A wrapper grown dynamic.
Tom



Quoting Lutz Michael <[EMAIL PROTECTED]>:

>
>
> One additional quick thought: someone mentioned using Commons Logging to
> switch back and forth between JDK logging, Log4j, and potentially other
> logging solutions.
>
> If one wraps Log4j as recommended by Ceki's book using Decorator (GoF), one
> realizes a similar effect.  The wrapper class could even load a particular
> logging solution at run-time based on system configuration.
>
> I get the impression that in general Ceki recommends wrapping Log4j.  Note
> that he strongly recommends against sub-classing Logger, which is often a
> developer's first direction.  Decorator is recommended, although I don't
> think an interface for Logger exists as such so one must emulate the Log4j
> interface if so desired.  An organization could also of course choose more
> of an Adapter approach, and make the interface whatever they prefer,
> potentially shooting for backward compatibility with a logging solution
> already in existence in the enterprise.
>
> This approach mitigates the risk of being tied to a particular solution,
> while not incurring the potential pains of Commons Logging.
>
> Mike
>
>
> -Original Message-
> From: Tbee [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 27, 2003 3:59 AM
> To: Log4J Users List
> Subject: RE: Log4J vs. java.util.logging
>
>
> > Admittedly, many of us at here at log4j-user@ are biased in favor of
> log4j.
>
> Really? Naah.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 
--
-
> This message and any included attachments are from Siemens Medical 
Solutions
>
> USA, Inc. 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Log4J vs. java.util.logging

2003-10-27 Thread Ceki Gülcü
Matthias,

Admittedly, many of us at here at log4j-user@ are biased in favor of log4j.

At 08:14 AM 10/27/2003 +0100, Matthias Petersen wrote:
Hi all,
thanks a lot for your mails. It seems that Log4J is definitive the right 
choice.

Bye
Matthias
--
Matthias Petersen
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Interesting deadlock situations - org.apache.log4j.spi.RootCategory

2003-10-25 Thread Ceki Gülcü
This issue did never came up until a few days ago. I had a long discussion 
with Erik Meade on irc on quite a similar problem. 
(irc://irc.freenode.org:6667 on channel #apache-log4j)

At 02:17 PM 10/24/2003 -0700, Elias Ross wrote:

I just came across a deadlock condition in my code brought out by
Log4J.  Here is a simplified view of the objects in play:
class State {
   Logger log1;
   synchronized void setState() {
 // Something takes a long time here
 log.debug("hello world");
   }
   synchronized Object getState() {
   }
   public String toString() {
  return "state=" + getState();
   }
}
So, imagine that I call in thread (1)

Logger log2;
State s = new State();
log.debug(s);
And then, in another thread (2), I called setState().  It is in the
middle of setState when this debug statement is fired.
In thread (1), the logger holds a lock on
'org.apache.log4j.spi.RootCategory'.  The renderer attempts construct
the message by calling s.toString(), and toString calls getState().
Thread (1) has to wait for setState in thread (2) to exit.  But setState
can't exit until it has finished logging.
So, I am wondering why can't the rendered render without holding the
lock on 'org.apache.log4j.spi.RootCategory'?
(An obvious fix is to not lock the getState routine.)

Maybe the moral of the story is don't have your debug statements hold
locks on your objects.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Log4J vs. java.util.logging

2003-10-24 Thread Ceki Gülcü
At 10:23 AM 10/24/2003 -0400, Shapira, Yoav wrote:

Howdy,
http://www.qos.ch/logging/thinkAgain.html
The above link is more related to commons-logging than to JDK 1.4 logging 
per se.

http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/Log4jvsJDKLogging
I modified and edited the above page. Please let me know what you think.

http://builder.com.com/5100-22-1046694.html

Log4j will be around.  The next major release, v1.3, is going to have 
several great new features to further distance log4j from JDK 1.4 
logging.  Use log4j.
I think that the log4j has many advantages over JDK 1.4 logging API. 
Furthermore, with the upcoming 1.3 version the difference will be very 
significant and impossible to ignore.

Yoav Shapira
Millennium ChemInformatics
>-Original Message-
>From: Matthias Petersen [mailto:[EMAIL PROTECTED]
>Sent: Friday, October 24, 2003 10:15 AM
>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]


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]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Request for enhancment in PatternLayout

2003-10-20 Thread Ceki Gülcü
How about creating new PatternConverter classes ?

See https://www.qos.ch/logging/PatternLayout.html for details.

At 10:41 AM 10/20/2003 -0700, Elias Ross wrote:

For the application I am working on, I receive log messages from
multiple machines.  It would be handy to include a new PatternLayout
character sequence %h (or %H or %a) to include the hostname that
generated the trap.  %h{1} would return the hostname without the domain.
Also, being able to reference system properties in the PatternLayout
would be handy, such as %j{java.version} or %j{instance.id} in my case.
Being able to reference system properties in general (for turning off
appenders) seems like a good idea.
I could easily add this feature myself to a private branch, but I figure
it's probably something better to be made available to all.  I can write
the patch, if that's easier.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Useful Object Renderers

2003-10-20 Thread Ceki Gülcü
Hi Daniel,

Comments below.

At 11:55 AM 10/20/2003 +0100, [EMAIL PROTECTED] wrote:
Hi all,

I'm wondering whether there are any useful object renderers that I haven't 
heard about, hopefully downloadable and easily integratable. Things I'd be 
looking to output without having to have long debugging logic in my code 
would be beans, JDBC ResultSet rows, and so on. Looking around the log4j 
codebase all I can see is one jms and one sax renderers, both rather basic.

It seems to me that this would be a very useful feature, improving the 
quality of usage practice with log4j. Just like layout patterns which 
allow you to log the locational information and avoid keeping such 
information in the log messages themselves (and thus having to maintain 
log messages such as log.debug("entering xyz.foo()") - much better as 
log.debug("entering")), standard object renderers reduce the complexity of 
the logging code. For instance, when wanting to output the contents of a 
bean, it would be nice to be able to just type:

log.debug(myBean);

Given the way object renderers work, that is of course not possible since 
beans are not subclasses of a particular class. One way to get around that 
would be for the logger to recognize an org.apache.log4j.BeanWrapper class 
so that this could be called like:

log.debug(new BeanWrapper(myBean));
Creating a BeanWrapper for each bean to be logged is certainly one way to 
mark a bean for object rendering. There are other ways which can complement 
new BeanWrapper creation. For example, one could program certain beans as 
implementing a certain interface, say "ObjectRenderedBean". The new 
BeanWrapper approach requires no support from the bean writer but creates 
an extra object for each log. The ObjectRenderedBean is the opposite: 
requires support from the programmer but no object creation.

Assuming log4j will try to render the bean contained within the new 
BeanWrapper object, how should BeanWrapperObjectRenderer look like? I mean 
the code of BeanWrapperObjectRenderer? Should all the getter fields of the 
bean be retrieved and rendered?

In any case, I think the inclusion of more useful standard Object 
Renderers into the log4j codebase would be a very good thing for log4j, 
and I'm wondering why this hasn't been done yet. Are there any reasons 
that I'm not aware of?
Including standard object renderers is an excellent idea. If those 
renderers were also generic, that would be really powerful.

Thanks,

Daniel
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Log level definitions

2003-10-20 Thread Ceki Gülcü
Log4j domains, which will be be introduced in log4j 1.3, should
provide a satisfactory solution to the problem of "insufficient
logging levels."
The code should be available within the next few weeks. Until then, I
would like to request that you bear with me. If log4j domains do not
satisfactorily solve the problem you are facing, please do not hesitate
to bring up the point again.
At 03:38 PM 10/20/2003 +0200, you wrote:
That is probably what Dennis was looking for. But I feel it exactly
shows my point; all but the debug level are well defined, with the debug
level being the big-ol'-bucket-of... ahhh. Yes. Because it includes
"critical method" info, but also "contents of
resultsets...parameters...performance...".
Suppose you need to find out why an application is taking a left turn
instead of the expected right turn. It's not a program error, or
warning, nor does it inform you each time it takes a left. So all you
have, is turning on debug and get overloaded with resultsets, and
variables and stuff, when you have no idea what class to look in at that
time.
Hence my suggestion for splitting up debug in two levels: trace (follow
the program logic) and debug (explain the program logic). It's all about
not mixing different scopes of information. But definitions like "fine",
"finer", "finest" is totally BS: what goes where?
In that line of reasoning, combined with your text, I have one more
thought: you also include performance information in the debug level,
and that made me think.
Usually when I'm all done with an application, and it works ok, AND I
have some time left or spare time, I'm wondering if I can improve stuff
somewhere. Now having performance info is great, but do I want it to be
cluttered with debug info? So: would having a totally separate (not
hierachically) category "performance" be interesting? Or is
performancing something that is done between info and trace? IMHO, it
does not hurt having performance info while tracing, so hierachically
would be ok.
So my current favorite ;-)
FATAL
ERROR
WARN
INFO
PERFORMANCE
TRACE
DEBUG
Sorry for addressing a subject that is so difficult to agree upon... On
the other hand, a talk about levels or contexts of logging information
might be educational. Love to hear reactions.
Tom







Shapira, Yoav wrote:

Howdy,
Did you mean this thread?
http://marc.theaimsgroup.com/?l=log4j-user&m=105189448809301&w=2
Yoav Shapira
Millennium ChemInformatics

-Original Message-
From: Dennis Cook [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 19, 2003 4:05 PM
To: [EMAIL PROTECTED]
Subject: Log level definitions
A little while back someone posted some definitions of the type of
information, for which the various logging levels should be used.  I
thought it quite good and would like to share it with some coworkers,
but I cannot locate it.  I am asking for a repost of that information.
thanks

-
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]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Logging levels

2003-10-19 Thread Ceki Gülcü
Your point is well taken and log4j domains to be introduced in log4j
1.3 will provide an very solution you mention. I would also like to
point our that you gave the TRACE level a higher weight than DEBUG,
i.e. you chose TRACE > DEBUG, but many developers assume
DEBUG > TRACE.
At 08:39 AM 10/19/2003 +0200, Tom Eugelink wrote:
IMHO, for as far as it matters, I do feel that one debug level is somewhat 
coarse. My debug information often has two levels of granularity. The main 
level being program flow and decision logic, the second level is logic 
support information like SQL statements, variable content, etc.

Ofcourse it is possible to add a second log4j category to handle the 
latter output, but that is somewhat overdone. Adding a "program logic 
marker" to highlight the logic output is an option.

But personally I'd feel for adding a "trace" level between info and debug, 
for showing program logic to get closer to the place where stuff goes 
wrong and then switch to debug.

INFO: show program configuration info, etc
TRACE: show program logic and flow
DEBUG: show logic explanation / reasoning
Tom

--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Enhancement Request

2003-10-19 Thread Ceki Gülcü
oup
www.dalmatian.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
This message and any included attachments are from Siemens Medical Solutions
USA, Inc. 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: need functionality to truncate the tail of fields using Patte rnLa yout

2003-10-16 Thread Ceki Gülcü


At 11:57 AM 10/16/2003 -0400, you wrote:
Wow, thanks for the fast response from the man himself.
That used to be the case. However, there are now several developers who 
regularly contribute to log4j, Mark, Paul, Scott, and Yoav to name a few.

I'm a bit baffled, though, as I thought what I had was the latest release,
version 1.2.8, which doesn't seem to have the enhancements you mention.  I'm
guessing this is because its in the currently cvs code which I would need to
get, rather than get the released version?
Yep, the CVS.

Thanks again.

doug

  >  -Original Message-----
  >  From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
  >  Sent: Thursday, October 16, 2003 11:45 AM
  >  To: Log4J Users List
  >  Subject: Re: need functionality to truncate the tail of
  >  fields using PatternLa yout
  >
  >  Doug,
  >
  >  There is no need to patch the files you mention. Actually,
  >  they don't even exist anymore.
  >
  >  PatternLayout has been modified to accept new conversion
  >  words. See https://www.qos.ch/logging/PatternLayout.html
  >  for more details.
  >
  >  I hope this helps,
  >
  >  At 11:24 AM 10/16/2003 -0400, Lethin, Doug wrote:
  >  >[I sent this message the other day to the dev mailing
  >  list and got no
  >  >response. I'm now sending this to the log4j user mailing
  >  list in case
  >  >anyone has any feedback for me. Thanks in advance.]
  >  >
  >  >I'm migrating my application to use log4j and need to
  >  define a message
  >  >format that's compatable with an output format already in
  >  place from my
  >  >original logging code. There are two formats I can't
  >  currently seem to do:
  >  >
  >  >1. I need to output the timestamp field as a two letter
  >  day of week
  >  >string
  >  >-- Mo, Tu, We, etc.
  >  >
  >  >2. I need to output the priority field as one character -
  >  D, I, W, E, F
  >  >
  >  >It seems the formatting directives in PatternLayout don't
  >  allow for this.
  >  >They allow you to truncate fields to a max value, but
  >  they're truncated
  >  >from the front, such that the directive '%.1p will
  >  truncate INFO to 'O'
  >  >and not 'I'
  >  >
  >  >I looked through the latest log4j code, and found a way
  >  to patch this
  >  >functionality in by adding another formatting directive
  >  similar to the '.'
  >  >but using a '#' instead.
  >  >
  >  >It will similarly define the max length for a field, BUT it will
  >  >truncate the trailing characters rather than the leading
  >  characters.
  >  >
  >  >Examples:
  >  >
  >  > %d{E}   -> Tuesday
  >  > %.2d{E} -> ay (original truncate directive)
  >  > %#2d{E} -> Tu (new truncate directive)
  >  > %p -> INFO
  >  > %.1p -> O
  >  > %#1p -> I
  >  >
  >  >In order to do this, I needed to make minor patches to 3 files:
  >  >
  >  >- org.apache.log4j.helpers.FormattingInfo.java
  >  >- org.apache.log4j.helpers.PatternConverter.java
  >  >- org.apache.log4j.helpers.PatternParser.java
  >  >
  >  >I'd be happy to submit these patches in the hopes that this
  >  >functionality could be added to the code base.
  >  >
  >  >I'm assuming all I need to do is send mail to dev mailing
  >  list with the
  >  >subject PATCH, or [PATCH], and then include in the
  >  message the three
  >  >diff -c outputs?
  >  >
  >  >Is this kind of functionality useful to others?
  >  >
  >  >Is this the approach I should be taking when proposing changes?
  >  >
  >  >Thanks in advance.
  >  >
  >  >Doug
  >  >
  >  >
  >  >--
  >  ---
  >  >To unsubscribe, e-mail: [EMAIL PROTECTED]
  >  >For additional commands, e-mail:
  >  [EMAIL PROTECTED]
  >
  >  --
  >  Ceki Gülcü
  >
  >For log4j documentation consider "The complete log4j manual"
  >ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
  >
  >import org.apache.Facetime;
  >ApacheCon US 2003, 18-21 November http://apachecon.com/
  >
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: need functionality to truncate the tail of fields using PatternLa yout

2003-10-16 Thread Ceki Gülcü
Doug,

There is no need to patch the files you mention. Actually, they don't even 
exist anymore.

PatternLayout has been modified to accept new conversion words. See 
https://www.qos.ch/logging/PatternLayout.html for more details.

I hope this helps,

At 11:24 AM 10/16/2003 -0400, Lethin, Doug wrote:
[I sent this message the other day to the dev mailing list and got no
response. I'm now sending this to the log4j user mailing list in case anyone
has any feedback for me. Thanks in advance.]
I'm migrating my application to use log4j and need to define a message
format that's compatable with an output format already in place from my
original logging code. There are two formats I can't currently seem to do:
1. I need to output the timestamp field as a two letter day of week string
-- Mo, Tu, We, etc.
2. I need to output the priority field as one character - D, I, W, E, F

It seems the formatting directives in PatternLayout don't allow for this.
They allow you to truncate fields to a max value, but they're truncated from
the front, such that the directive '%.1p will truncate INFO to 'O' and not
'I'
I looked through the latest log4j code, and found a way to patch this
functionality in by adding another formatting directive similar to the '.'
but using a '#' instead.
It will similarly define the max length for a field, BUT it will truncate
the trailing characters rather than the leading characters.
Examples:

%d{E}   -> Tuesday
%.2d{E} -> ay (original truncate directive)
%#2d{E} -> Tu (new truncate directive)
%p -> INFO
%.1p -> O
%#1p -> I
In order to do this, I needed to make minor patches to 3 files:

- org.apache.log4j.helpers.FormattingInfo.java
- org.apache.log4j.helpers.PatternConverter.java
- org.apache.log4j.helpers.PatternParser.java
I'd be happy to submit these patches in the hopes that this functionality
could be added to the code base.
I'm assuming all I need to do is send mail to dev mailing list with the
subject PATCH, or [PATCH], and then include in the message the three diff -c
outputs?
Is this kind of functionality useful to others?

Is this the approach I should be taking when proposing changes?

Thanks in advance.

Doug

-----
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


Re: log4j xml configuration

2003-10-03 Thread Ceki Gülcü
At 12:11 PM 10/3/2003 -0500, you wrote:
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  
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).
Actually, it's log4j.xml first and log4j.properties second. Of course, this 
does not help in hunting down the problem.

--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: log4j using appender but not specified pattern

2003-10-03 Thread Ceki Gülcü
Hi Tom,

This may indicate that a different config file is in use.

At 11:43 AM 10/3/2003 +, tom ONeill wrote:
Hi Ceki,

I dont actually get the internal logging output. The root element of the 
properties is as follows:

http://jakarta.apache.org/log4j/"; 
debug="true">

However I dont get the debug output so Im none the wiser there

Tom


From: Ceki Gülcü <[EMAIL PROTECTED]>
Reply-To: "Log4J Users List" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Subject: Re: log4j using appender but not specified pattern
Date: Fri, 03 Oct 2003 11:14:20 +0200
Tom,

The configuration directives look good. What does the log4j internal 
logging output say?

At 08:36 AM 10/3/2003 +, tom ONeill wrote:
Hi all,

I was wondering if anyone could give me some ideas on what might be 
causing a small problem that I have. In my log4j properties file (XML 
format) I have set up a particular appender that writes to a file. I 
have also specified a particular Pattern for the appender. Now the 
logging entries are being written to the appender but are not using the 
pattern that I specified.

The appender is specified in the logging file as follows


   
   
   
  
   

This appender is then associated with a a particular logger as follows:


   
   


When I execute my application the Perf.log file is being written however 
it does not include the datetime which I would expect from using %d in 
the specified pattern for the appender. Not all the code is my own so 
its possible that there is somthing going on that I dont know about but 
what I need to know is the possible ways in which an appender could be 
used without actually using the specified pattern?

Thanks,

Tom
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: log4j using appender but not specified pattern

2003-10-03 Thread Ceki Gülcü
Tom,

The configuration directives look good. What does the log4j internal 
logging output say?

At 08:36 AM 10/3/2003 +, tom ONeill wrote:
Hi all,

I was wondering if anyone could give me some ideas on what might be 
causing a small problem that I have. In my log4j properties file (XML 
format) I have set up a particular appender that writes to a file. I have 
also specified a particular Pattern for the appender. Now the logging 
entries are being written to the appender but are not using the pattern 
that I specified.

The appender is specified in the logging file as follows


   
   
   
  
   

This appender is then associated with a a particular logger as follows:


   
   


When I execute my application the Perf.log file is being written however 
it does not include the datetime which I would expect from using %d in the 
specified pattern for the appender. Not all the code is my own so its 
possible that there is somthing going on that I dont know about but what I 
need to know is the possible ways in which an appender could be used 
without actually using the specified pattern?

Thanks,

Tom
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: BufferSize always the same

2003-10-02 Thread Ceki Gülcü
I should have verified for typos before posting my reply. Corrections below.

At 05:10 PM 10/2/2003 +0200, you wrote:
Well, in Java IO there are buffers and buffers.

Even if you do *not* set the bufferedIO option in FileAppender, that is if 
bufferedIO is set to false, writing to the file is buffered. 
FileOutputStream is buffered.
I mean to say that FileOutputStream *always* buffers writes to the hard 
disk independently of FileAppender's bufferedIO option.

If you set the bufferedIO option, FileAppender will buffer String 
(unicode) to stream conversions, FileOutputStream will continue to buffer 
writes to physical media.
FileAppender's bufferedIO option only saves String (unicode) to stream 
conversions.

At 09:26 AM 10/2/2003 -0500, Pascal Rheaume (QC/EMC) wrote:
Hi,

I'm using a custom FileAppender with buffered io because speed is really 
important for me. I have amazing improvement over not buffered io, so I 
would like to keep it buffered. I'm able to live with a small lost of 
logging at the end due to the buffer that has not been emptied. And if 
I'm correct, the default size for the buffer is 8kb. For me, 8kb is too 
big so I want to reduce this size.
Yes, the default buffer for buffered for BufferedWriter is 8KB.
Yes, the default buffer for BufferedWriter (created by FileAppender when 
bufferedIO=yes) is 8KB.

I am surprised to learn that the bufferedIO option yields in "an amazing 
improvement". Which JDK version are you using?


Here is my problem: whatever number I put in the BufferSize parameter, it 
is ALWAYS a 8kb buffer. The final size of my log file is 8kb or less than 
the log file I would have for the same operations sequence in a not 
buffered IO.
I fail to not understand the above sentence.


I set the ImmediateFlush parameter to false and the BufferedIO parameter 
to true. So, anybody has an idea on what could be the source of my 
problem here? I really don' get it!

I have a secondary question: that BufferSize parameter, is it a size in 
kb or a size in number of log statements?
It size in bytes.
The size is in bytes.


 Because, if what I read was correct, in AsyncAppender, BufferSize is a 
number of log statements.
Correct.  In AsyncAppender, BufferSize is the number of log statements.

Pascal
--
Ceki Gülcü
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: BufferSize always the same

2003-10-02 Thread Ceki Gülcü
Well, in Java IO there are buffers and buffers.

Even if you do *not* set the bufferedIO option in FileAppender, that is if 
bufferedIO is set to false, writing to the file is buffered. 
FileOutputStream is buffered.

If you set the bufferedIO option, FileAppender will buffer String (unicode) 
to stream conversions, FileOutputStream will continue to buffer writes to 
physical media.



At 09:26 AM 10/2/2003 -0500, Pascal Rheaume (QC/EMC) wrote:
Hi,

I'm using a custom FileAppender with buffered io because speed is really 
important for me. I have amazing improvement over not buffered io, so I 
would like to keep it buffered. I'm able to live with a small lost of 
logging at the end due to the buffer that has not been emptied. And if I'm 
correct, the default size for the buffer is 8kb. For me, 8kb is too big so 
I want to reduce this size.
Yes, the default buffer for buffered for BufferedWriter is 8KB.

I am surprised to learn that the bufferedIO option yields in "an amazing 
improvement". Which JDK version are you using?


Here is my problem: whatever number I put in the BufferSize parameter, it 
is ALWAYS a 8kb buffer. The final size of my log file is 8kb or less than 
the log file I would have for the same operations sequence in a not 
buffered IO.
I fail to not understand the above sentence.


I set the ImmediateFlush parameter to false and the BufferedIO parameter 
to true. So, anybody has an idea on what could be the source of my problem 
here? I really don' get it!

I have a secondary question: that BufferSize parameter, is it a size in kb 
or a size in number of log statements?
It size in bytes.

 Because, if what I read was correct, in AsyncAppender, BufferSize is a 
number of log statements.
Correct.  In AsyncAppender, BufferSize is a number of log statements.

Pascal
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: dumb newbie question?

2003-10-01 Thread Ceki Gülcü
Not environment variables, system properties!

System properties are Java specific.

Try ${catalina.home}/...

At 10:16 AM 10/1/2003 -0800, you wrote:
First off, I am under Windows2000. Is what you have said
platform-independent?
I have system variable CATALINA_HOME=C:\Tomcat4.1
In log4j.properties, I specify
log4j.appender.LOGMSGS.File=${CATALINA_HOME}/webapps/myapp/WEB-INF/log/messages.log
What I get is a FileNotFoundException:
\webapps\myapp\WEB-INF\log\messages.log
I tried with %CATALINA_HOME% instead of ${CATALINA_HOME}, and I still get
the same exception...
-Rishi

> You can use variable substitution.
>
> Assuming catalina.home is a system property, then you can specify the
> path as
>
>${catalina.home}/webapps/myapp/WEB-INF/log
>
> Just to make sure to use the right variable name.
--
  Rishikesh Tembe
  [EMAIL PROTECTED]
--
http://www.fastmail.fm - Sent 0.02 seconds ago
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: dumb newbie question?

2003-10-01 Thread Ceki Gülcü
There is no such thing as a dumb question. See also below.

At 09:39 AM 10/1/2003 -0800, Rishikesh Tembe wrote:
Hi group,

Is there a way I can specify an absolute path for the File for the
DailyRollingFileAppender in my log4j.properties?
I want my log files to be located in the
CATALINA_HOME/webapps/myapp/WEB-INF/log directory. How can I specify this
destination without tying it down to the actual location of Tomcat?
You can use variable substitution.

Assuming catalina.home is a system property, then you can specify the path as

  ${catalina.home}/webapps/myapp/WEB-INF/log

Just to make sure to use the right variable name.

I have tried various options but none seem to work.

thanks,
Rishi
--
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Problem with HTMLLayout (log file attached)

2003-10-01 Thread Ceki Gülcü
The file did not go through. The log4j-user mailing list filters out 
certain file types and has a size limit of 100KB.

Maybe the table is not properly formatted? Look at the HTML file at the 
spot where things start to go wrong.

At 07:56 AM 10/1/2003 -0700, Rajat Sharma wrote:
Hi

Sorry about that... The log files are 10MB each, so I'm attaching a part 
of the log file that shows the formatting problem. This problem is 
occuring in all of the log files (there are 5 separate logs being 
created). Could this occur due to the fact that I have set the Append 
value to 'true' and there's some problem when the application is restarted 
and the old log file is still there? I tried testing that on my box, but 
that doesn't seem to be the issue. This is seemingly happening at random, 
but I'm sure there's something I'm doing wrong!

Thanks in advance for your help.

Rajat.

Ceki Gülcü <[EMAIL PROTECTED]> wrote:
Can you include the resulting HTML file?
Please do not send HTML-stylized text to this mailing lists.

At 01:11 PM 9/30/2003 -0700, Rajat Sharma wrote:
>Hi
>
>I just put my application into testing and problems are pouring in... The
>latest one is with the HTMLLayout. In the middle of the log, the appender
>wrote this to the log file, and everything after this wasn't formatted in
>the display... (after some logging messages, it wrote some similar HTML to
>the log and the messages after that were formatted properly while
>displaying the log in IE).
>
>>"http://www.w3.org/TR/html4/loose.dtd";>
>
>Log session start time Tue Sep 30 10:25:11 CDT 2003
>
>Time Thread Level Category Message
>
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Problem with HTMLLayout

2003-09-30 Thread Ceki Gülcü
Can you include the resulting HTML file?

Please do not send HTML-stylized text to this mailing lists.

At 01:11 PM 9/30/2003 -0700, Rajat Sharma wrote:
Hi

I just put my application into testing and problems are pouring in... The 
latest one is with the HTMLLayout. In the middle of the log, the appender 
wrote this to the log file, and everything after this wasn't formatted in 
the display... (after some logging messages, it wrote some similar HTML to 
the log and the messages after that were formatted properly while 
displaying the log in IE).

http://www.w3.org/TR/html4/loose.dtd";>

Log session start time Tue Sep 30 10:25:11 CDT 2003

Time Thread Level Category Message





Hope someone can guide me about what may be happening and what can be done 
about it.

regards
Rajat.
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Antwort: configure and watch log4j.xml

2003-09-30 Thread Ceki Gülcü
DOMConfigurator.configureAndWatch method creates a thread which is never 
stopped.

My recommendation would be to avoid 
using  DOMConfigurator.configureAndWatch or 
Propertyonfigurator.configureAndWatch within J2EE applications (web or EJB).

See also http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15896

At 11:05 AM 9/30/2003 +0200, [EMAIL PROTECTED] wrote:

hi,

DOMConfigurator.configureAndWatch( ) is what you are looking for.

Hi,

Is there some property I can set so that Log4j watches the log4j.xml
configuration file, if the file changes, the configuration is reloaded?
thanks
Nathan
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Questions on initial log4j instance

2003-09-29 Thread Ceki Gülcü
Yes, of course 'volatile' not 'transient'.

I somehow merged volatile and transient in my mind.

At 09:50 AM 9/29/2003 -0700, Kevin Klinemeier wrote:
Do you mean 'volatile' here?  I can't find in the JLS where transient
has this affect.  It wouldn't be the first time I've looked for
something in the JLS and not found it, though.
-Kevin

--- Ceki Gülcü <[EMAIL PROTECTED]> wrote:
> Moreover, in addition to serialization aspects, the keyword
> 'transient' has
> other meanings. It forces the JVM to re-reread the value of the
> variable
> from memory for each access, adding unnecessary overhead.
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Questions on initial log4j instance

2003-09-29 Thread Ceki Gülcü
At 04:58 PM 9/29/2003 +0800, Yu Xiang Xi  (Maveo) wrote:
I have seen different usage of initial log4j instance like below
private final static Logger logger = Logger.getLogger("some.name");
looks good.

and
private final transient static Logger logger =
Logger.getLogger("some.name");
the second one has a additional keyword transient.
Loggers cannot be serialized so marking them transient can be useful for 
non static loggers.

However, since static variables are not serialized, there is no need to 
mark them as transient.

Moreover, in addition to serialization aspects, the keyword 'transient' has 
other meanings. It forces the JVM to re-reread the value of the variable 
from memory for each access, adding unnecessary overhead.

Which way is recommended?
The recommended form is:

  private static final Logger logger = ...


Thanks in advance.

Best Regards
Xi Yuxiang
Maveo Systems Limited
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Fwd: Reminder: Hyper-Early Bird Registration Ends Soon

2003-09-26 Thread Ceki Gülcü
FYI

Date: Fri, 26 Sep 2003 09:35:38 -0700 (PDT)
From: Sally Khudairi <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Reminder: Hyper-Early Bird Registration Ends Soon
 + + ONLY 4 DAYS LEFT + +

Hyper-Early Bird Registration for ApacheCon 2003 is
available until 23.59ET on 30 September.
By registering now, you can save up to US$400!

   ApacheCon US 2003
   16-19 November 2003
   Alexis Park Resort
   Las Vegas, Nevada, US
More than 60 sessions highlight core and
next-generation Apache server tools, offering a wide
range of beginner, intermediate and advanced sessions.
Learn firsthand the latest developments in Apache, the
world's most popular Web server software, as well as
key open source projects, including PHP, Perl, XML,
Java, MySQL, and WebDAV. ApacheCon 2003 is going to be
a great event with a three-day vendor expo, social
activities, BOFs and more.  We want you to be a part
of it!
   Hyper-Early bird registration fee: US$499
   After 30 September: US$599
   After 20 October: US$799
   After 16 November: US$899
Register today at http://www.apachecon.com/
We look forward to seeing you there!
- Sally Khudairi
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: different files

2003-09-26 Thread Ceki Gülcü
Alan,

Have you tried putting log4j.jar in a directory accessible to the common 
loader?

At 01:07 PM 9/26/2003 -0300, Alan Roberto Romaniuc wrote:

Hi,

   I have a "library" L which uses log4j.
   I have a application A, which uses L and log4j,
   I have a application B, which uses L and log4j too.
   A and B runs together (inside tomcat...),
I am able to do differents logs, A.log(A),B.log (B) and L.log (L) , 
but I would like to log
  L in B.log, when B calls it, and L in A.log when A calls it.

I've been looking for that a long time at the internet, but found 
nothing.. any help?
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Override values from log4j.properties on jvm command line?

2003-09-25 Thread Ceki Gülcü
At 04:25 PM 9/24/2003 -0700, Karr, David wrote:
I have a log4j.properties file that has the default level of the root
logger set to "INFO".  When I run my application in my debugger, I'd
typically like to set the default level to "DEBUG", but without having
to change the properties file, and without having to change code.
I thought that I could just add "-Dlog4j.rootLogger=DEBUG" to the jvm
command line, but that seemed to have no effect.
That's is normal. Log4j does not scan the system properties to check 
whether they contain log4j configuration directives.

You to need a configuration file.

I guess I'm using Log4J 1.2.8.
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Plans for supporting a build in level of "trace"

2003-09-25 Thread Ceki Gülcü
At 05:05 PM 9/24/2003 -0500, Jensen, Jeff wrote:

Having a new domains feature solve the "fixed list of types" issue(s) 
sounds great.  Hopefully it is "cross-dimensional" to coordinate not only 
a "priority/level" but a "functional area" as well.
"Functional area". Exactly.


> -Original Message-
> From: Lutz Michael [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 24, 2003 4:50 PM
> To: 'Log4J Users List'
> Subject: RE: Plans for supporting a build in level of "trace"
>
>
>
>
> Is there a location where "logging domains" are documented?
> I'd really like to read about the concept(s).
>
> Thanks in advance.
>
> Mike
>
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Plans for supporting a build in level of "trace"

2003-09-25 Thread Ceki Gülcü
There is no documentation on log4j domains yet. However, a short spec will 
be written before coding. Domains will have an impact on the inner 
architecture of log4j, so prior documentation should help with the coding.

At 05:50 PM 9/24/2003 -0400, Lutz Michael wrote:


Is there a location where "logging domains" are documented?
I'd really like to read about the concept(s).
Thanks in advance.

Mike
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: logfactor5 download?

2003-09-24 Thread Ceki Gülcü
At 04:00 PM 9/24/2003 -0400, you wrote:

Howdy,
I thought it was included in the log4j download itself??
That is correct.

Yoav Shapira
Millennium ChemInformatics
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Closed appender issue on configuration reload

2003-09-24 Thread Ceki Gülcü
At 02:12 PM 9/24/2003 +, Guðlaugur Stefán Egilsson wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi

I have a minor problem with reloading my log4j configuration.
I am working with an application which is deployed as a web
service within Tomcat. There are other applications deployed
there as well, and all of them need to use a common
RemoteAppender. There can be only one RemoteAppender, since it
binds to a TCP port, which is of course exclusive.
Hmm. That does not sound right. You can have as many SocketApenders as you 
want. You mean SocketAppender don't you?

The server port is exclusive, client ports are not.

--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Closed appender issue on configuration reload

2003-09-24 Thread Ceki Gülcü
Why is 'RemoteAppender' an appender? If the purpose of 'RemoteAppender' is 
to receive events from remote clients, it should not be an appender. Right?

At 02:12 PM 9/24/2003 +, you wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi

I have a minor problem with reloading my log4j configuration.
I am working with an application which is deployed as a web
service within Tomcat. There are other applications deployed
there as well, and all of them need to use a common
RemoteAppender. There can be only one RemoteAppender, since it
binds to a TCP port, which is of course exclusive.
To get that to work required a little bit of code, but
essentially I used the Servlet approach described in the manual,
and extended it to get the appender and add it to newly created
loggers. This works quite nicely until a reload of the web
service occurs. What happens then is that the Servlet is reloaded,
causing reload of the configuration, with the loggers already
existing
this time. This prompts the configurator to remove all existing
appenders from the loggers, which for some reason closes the
appenders
too. (why is that necessary??). This of course closes the
RemoteAppender,
thereby rendering it useless to all the services using it.
So, my first question is, is there any short way around this?

And the second question is, is this desirable behaviour? It seems to
me that a reconfiguration should not have adverse side effects, such
as closing appenders which are not reopened automatically...
Regards

Guðlaugur Stefán Egilsson
Dimon Software
http://www.dimonsoftware.com
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Plans for supporting a build in level of "trace"

2003-09-24 Thread Ceki Gülcü
Although catering for user requests is one of the guiding principles
behind this project, I feel that introducing the TRACE level would be
a mistake. Log4j domains which will be soon introduced into log4j
provide a much more powerful mechanism for categorizing logging
statements.
Please bear with me for a few more days.

See also below.

At 11:23 AM 9/24/2003 +1000, Paul Smith wrote:
IMHO, the simplicity of Debug/info/warn/error/fatal is one of Log4j's
strengths. I personally would not want Trace  However, if I required
Trace-style logging, I would simply log to a dotted logger name
"---.trace".
E.g If I have a component "com.mycompany.mycomponent", I have a
complimentary "com.mycomany.mycomponent.trace" logger, and configure
Log4j to suppress this logger under normal circumstances.
Log4j domains are/will be your friend.

The other advantage to this approach is that you can get all Trace style
logs into their own appender very easily (attach the appropriate
appender to each .trace logger in the config), which means my trace logs
are separated easily from the other debug, which I think is what a lot
of people are worried about.  I can't see anyone wanting to wade through
Trace AND Debug log messages to find things out, but maybe I can't see
the use case that other people have.
Did I mention log4j domains?

Having said all this, as a Log4j developer I wonder since we've
previously made a lot of effort to match JDK 1.4's syntax (e.g.
Category->Logger, Priority->Level), one might argue that it's not too
much effort to go that extra mile to just add the Trace level for those
that way inclined.
Perhaps those log4j dev-people who were involved in the Log4j-JDK1.4
matching development might be able to comment on any rationale etc.  But
for me, I'm very happy with the current Trace-less log4j.
The idea was to be as friendly as possible to the JDK 1.4 users
migrating to log4j from JDK 1.4 logging. As a whole, it was a good
move although renaming priority to level was probably not worth the
trouble.
Once log4j 1.3 is introduced, developers will realize how much more
advanced the log4j API is compared to JDK 1.4 logging.
Paul Smith
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Configuring a wrapper class for rolling policies

2003-09-23 Thread Ceki Gülcü
Composite components such as org.apache.log4j.rolling.RollingFileAppender 
must be configured using DOMConfigurator or JoranConfigurator.

Note that DOMConfigurator is deprecated in 1.3 and will be replaced with 
JoranConfigurator. However, JoranConfigurator is not yet ready. (Of course 
1.3 is not either.)

At 03:23 PM 9/23/2003 +0200, you wrote:
Hi all!
I.m using a wrapper class (i.e 
org.apache.log4j.rolling.MyTimeBasedRollingPolicy) to performance an 
specific rollingPolicy for my purpose.
Is there any way to configure it in log4j properties file?
i tried something like :

log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.A1.RollingPolicy=org.apache.log4j.rolling.MyTimeBasedRollingPolicy
log4j.appender.A1.RollingPolicy.ActiveLogFile=my_log.txt
log4j.appender.A1.RollingPolicy.FileNamePattern='.'-MM-dd-HH-mm
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
but it doesn´t work.
Thanks in advance
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Messages Going to Multiple Loggers

2003-09-19 Thread Ceki Gülcü
Dhruva,

It's actually

 log4j.additivity.notify=false

my bad.

Anyway, I'm glad switching to XML solved the problem.

At 01:45 PM 9/19/2003 -0700, you wrote:
Well, I couldn't get this to work using a properties file, either as

log4j.additivity.logger.notify=false

or

log4j.logger.notify.additivity=false

However, I tried switching to XML (which is much easier to read,
anyway):

  
  

and that did it.

Thanks for your responses!
Dhruva
--- Ceki Gülcü <[EMAIL PROTECTED]> wrote:
>
> Additivity applies to loggers not appenders.
>
> Try:
>
> log4j.additivity.logger.notify=false
>
> which should do exactly what you want.
>
> HTH,
>
> At 12:38 PM 9/19/2003 -0700, Dhruva B. Reddy wrote:
> >Perhaps I should rephrase the question--is there any way to prevent
> a
> >logger from inheriting the rootLogger's appenders?
> >
> >I tried adding additivity to the appender, and it didn't like it:
> >
> > log4j.appender.email.additivity=false
> >
> >resulted in:
> >
> > log4j:WARN No such property [additivity] in
> >org.apache.log4j.net.SMTPAppender.
> >
> >I also tried adding it to the notify logger, and it ignored it:
> >
> > log4j.logger.notify.additivity=false
> >
> >Thanks,
> >Dhruva
>
> --
> Ceki Gülcü
>
>   For log4j documentation consider "The complete log4j manual"
>   ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>   import org.apache.Facetime;
>   ApacheCon US 2003, 18-21 November http://apachecon.com/
>
>
>
> -
> 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
http://sitebuilder.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Messages Going to Multiple Loggers

2003-09-19 Thread Ceki Gülcü
Additivity applies to loggers not appenders.

Try:

log4j.additivity.logger.notify=false

which should do exactly what you want.

HTH,

At 12:38 PM 9/19/2003 -0700, Dhruva B. Reddy wrote:
Perhaps I should rephrase the question--is there any way to prevent a
logger from inheriting the rootLogger's appenders?
I tried adding additivity to the appender, and it didn't like it:

log4j.appender.email.additivity=false

resulted in:

log4j:WARN No such property [additivity] in
org.apache.log4j.net.SMTPAppender.
I also tried adding it to the notify logger, and it ignored it:

log4j.logger.notify.additivity=false

Thanks,
Dhruva
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: usage of ${xxx} properties in log4j.xml

2003-09-19 Thread Ceki Gülcü
The DOMConfigurator which parses log4j config files in XML, performs 
variable substitution for the system properties, i.e. those obtained 
through a System.getProperty() call.

So, the JBoss are probably setting a system property called 
"jboss.server.home.dir".

HTH,

At 04:21 PM 9/19/2003 +0200, Uechi Fabio wrote:
Hello everybody,

I want to set dinamically the location where my log file will be
created.
I was checking jboss log4j.xml and I saw they are using properties
like: ${jboss.server.home.dir} , similar to the ones used in ants build
scripts.
Does anyone know from where the value for this property comes from??
Here is the example I mentioned:
  
  


Thanks in advance
Fabio
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Logger and threads

2003-09-19 Thread Ceki Gülcü
Ciao Matteo,

Logger is thread safe. See also below.

At 10:06 AM 9/19/2003 +0200, Matteo Sotil Bertanzetti wrote:
My first question: Is Logger thread safe?.

I mean, if multiple threads use one same Logger instance, is there some 
synchronization problem?, is necessary to synchronize it with some code 
like: synchronized(logger){logger.debug("");} ?.
If it is necessary as I guess, I think is better to use an internal 
function to avoid repeating 'synchronized... if(logger.isDebugEnabled()) 
' every time you want to log; for example:

private void debug(String sMessage)
{
synchronized(logger)
{
if(logger.isDebugEnabled())
{
logger.debug(sMessage);
}
}
}
Am I right?. But in this case, logger.isDebugEnabled() is useless, because 
cost of constructing string is already done; isn't it?.
Correct. But logger is thread safe.

One solution I see to this problem is using just4log 
(http://just4log.sourceforge.net/), as Milind Rao pointed on last message.

My second question: if Logger is not thread safe, what is the better 
choice to make it safe?.
but Logger is thread safe. :-)

Thank you and sorry for my English...
I hope this alleviates your concerns.

Matteo
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Advice needed

2003-09-17 Thread Ceki Gülcü
At 10:10 AM 9/17/2003 -0500, you wrote:
Greetings:
  A few questions.
  We are using the daily rolling file appender.  Last night or app died
under a heavy test run.
  The log size reached 259,998kb.
  The console(or log file) showed no specific errors from log4j or
Jboss.
  1 - Is there an upper file limit?
No, there is not.

  2 - As I understand it Log4j *will not* shut down our app if it has a
problem.
Correct.

  3 - Is it bad practice to allow log files to grow that big?
  We will probably keep our logging quite verbose for
the first while when we go live.
  Should be rolling on file size instead of date?
Rolling the log file once a day or once a week is common practice.

  Can we roll on both date and file size? ie: new file each day
unless it reaches a certain size.
This has been discussed before. See the archives.


We are using
 jboss-3.0.4_tomcat-4.0.6 (i believe has log4j 1.2.2), JDK 1.4.1, running
on NT
Any advice would be welcome..
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Rod Waldhoff on commons logging...

2003-09-16 Thread Ceki Gülcü
  http://radio.weblogs.com/0122027/2003/08/15.html

This blogging thingy is pretty neat.

--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: log4j, JBoss, EJBs

2003-09-16 Thread Ceki Gülcü
Exactly. Once can also set a 'null' guard in the first place.

At 10:11 AM 9/16/2003 -0500, Jacob Kjome wrote:
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
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: JAAS user

2003-09-16 Thread Ceki Gülcü
Emmanuel,

I am afraid I fail to understand your question. What are your trying to 
bypass? What do you mean by "whereas the file writing should not be refused 
by a loss of privileges"?

At 09:50 AM 9/16/2003 -0400, you wrote:
Hi,



I’m developing a web application with Struts and some EJBs and I use JAAS.
All the code is executed inside a PrivilegedAction class. When I execute the
code :


  Subject subject = Subject.getSubject((AccessControlContext)
System.getSecurityManager().getSecurityContext());


I got an instance of the subject corresponding to the current user.



Anywhere I run this line of code, I got a subject, even inside an EJB.



But what I want to do now is logging the username on every line of log.



To do this, I subclassed the PatternLayout class to make it looks like this
:


package com.cpa.log.layout;

import org.apache.log4j.PatternLayout;

import org.apache.log4j.spi.LoggingEvent;

import java.util.*;



import javax.security.auth.*;

import javax.security.auth.login.*;

import java.security.*;



public class CpaLayout extends PatternLayout  {

  public CpaLayout() {

  }



  public String format(LoggingEvent event) {

String log = this.getConversionPattern();

if (log.indexOf("%u") > 0) {

  Subject subject = Subject.getSubject((AccessControlContext)
System.getSecurityManager().getSecurityContext());
  String login = "";

  if (subject != null) {

login = ((Principal)
subject.getPrincipals().iterator().next()).getName();
  }

  else {

login = "nobody";

  }

  log = log.substring(0, log.indexOf("%u")) + login +
log.substring(log.indexOf("%u")+2, log.length());
}

this.setConversionPattern(log);

log = super.format(event);

return log;

  }

}



This new layout works exactly the same then the PatternLayout. Exept that I
can add a new convertion character (%u) who is replaced by the first
principal (the username) of the current subject.


So the subject returned is null. I suppose that this error is normal,
whereas the file writing should not be refused by a loss of privileges.


So how this works and how can I bypass it?



And does a means of doing what I try already exists? i.e. log the username
of the current JAAS user in log files.




Emmanuel Potvin

Les consultants Parent et associés inc.

(418)802-8439


--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Multiple loggers of different web applications in one web server

2003-09-16 Thread Ceki Gülcü
Do all the webapps log to the same file?

At 07:53 PM 9/16/2003 +0800, lhelper wrote:
Hi All:
  I've run into a problem with having multiple webapps within one web 
server (resin), one logger for each webapp, and about 4~5 instances for 
the primary servlet of each webapp, I use DailyRollingFileAppender do 
logging in all applications, my problem is the loggers do well most the 
time, but when I restart the web server sometimes, the loggers output all 
the log into just one log file, others can receive nothing, but anything 
works well again after the daily rolling.

  I use a init servlet parse the conf file for each webapp. My log4j conf 
files of each webapp are similar with each other, they look like:
log4j.rootCategory=DEBUG, A1
log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.File=FILENAME.LOG # the filename is different from each 
other
log4j.appender.A1.DatePattern='.'-MM-dd
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%-5p] - %m%n

  And I use:
log4j1.2
resin-2.1.10
j2sdk1.4.2_01
redhat linux 2.4.20
Is there anybody has the same problem? Any opinion is appreciate!pi
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


RE: Log4j Initialization

2003-09-16 Thread Ceki Gülcü
re, 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]
>
>
>
> NOTE: This e-mail message is subject to the MTN Group
> disclaimer see http://www.mtn.co.za/email_disclaimer.asp
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


-
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-13 Thread Ceki Gülcü
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.
>>
>>
>>
>>
>>http://jakarta.apache.org/log4j/";>
>>   
>> 
>>   
>> 
>>   
>>   
>> 
>> 
>>   
>>   
>> 
>> 
>>   
>>
>>
>>When I use this same file with struts and log4j, I am able to get the
>> file to load ok, I verified this with some System.out.printlns. The
>> code also correctly checks and finds the debug levels when calling;
>> logger.isDebugEnabled() or logger.isInfoEnabled()
>>
>>However the code crashes when I try to call;
>>logger.debug("foo") or logger.info("foo") at
>>com.adligo.systems.ae.ui.http.LoginAction.execute(LoginAction.java:34)
>>
>>The following is the whole error.
>>
>>java.lang.NoSuchMethodError:
>>org.apache.log4j.spi.LoggingEvent.getLevel()Lorg/apache/log4j/Level;
>> at
>>org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:206)
>> at
>> 
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
>> at org.apache.log4j.Category.callAppenders(Category.java:190)
>> at org.apache.log4j.Category.forcedLog(Category.java:375) at
>> org.apache.log4j.Category.debug(Category.java:244)
>> at
>>com.adligo.systems.ae.ui.http.LoginAction.execute(LoginAction.java:34)
>> at
>>org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr 
ocessor.java:484)
>> at
>>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 
274)
>> at
>>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>> at
>>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>> at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>
>>Any help here would be greatly appreciated!
>>--
>>Scott Morgan
>>President Adligo Inc.
>>Ph:  773-758-8735
>>Fax: 773-632-0568
>>http://www.adligo.com
>>
>>
>>
>>
>>
>>-
>> To unsubscribe, e-mail: [EMAIL PROTECTED] For
>> additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> Ceki Gülcü
>
>   For log4j documentation consider "The complete log4j manual" ISBN:
> 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
>
>   import org.apache.Facetime;
>   ApacheCon US 2003, 18-21 November http://apachecon.com/
>
>
>
> - To
> unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
Scott Morgan
President Adligo Inc.
Ph:  773-758-8735
Fax: 773-632-0568
http://www.adligo.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: Syntax Verification and Velocity Logging to Console

2003-09-12 Thread Ceki Gülcü
The level values are seem OK.

However, no need to have an appender-ref in each logger. Appenders are 
inherited cumulatively.

  

  
  


  
I assume an appender named CONSOLE is defined somewhere... right?

At 06:32 AM 9/12/2003 -0600, Matt Raible wrote:
If I want to "warn" for all apache projects, but then override that
setting for Velocity - is the following syntax correct?  It doesn't seem
to be working, that's why I ask:
  


  
  


  
In my velocity.properties file, I have:
runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JL
ogSystem
runtime.log.logsystem.log4j.logger=org.apache.velocity
And I am getting a velocity.log file in my working directory, just
nothing in the console.
Thanks,

Matt
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


-
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-12 Thread Ceki Gülcü
- 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.


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

  

  
  


  
  


  

When I use this same file with struts and log4j, I am able to get
the file to load ok, I verified this with some System.out.printlns. The
code also correctly checks and finds the debug levels when calling;
logger.isDebugEnabled() or logger.isInfoEnabled()
However the code crashes when I try to call;
logger.debug("foo") or logger.info("foo") at
com.adligo.systems.ae.ui.http.LoginAction.execute(LoginAction.java:34)
The following is the whole error.

java.lang.NoSuchMethodError:
org.apache.log4j.spi.LoggingEvent.getLevel()Lorg/apache/log4j/Level;
at
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:206) at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
at org.apache.log4j.Category.callAppenders(Category.java:190)
at org.apache.log4j.Category.forcedLog(Category.java:375)
at org.apache.log4j.Category.debug(Category.java:244)
at
com.adligo.systems.ae.ui.http.LoginAction.execute(LoginAction.java:34)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Any help here would be greatly appreciated!
--
Scott Morgan
President Adligo Inc.
Ph:  773-758-8735
Fax: 773-632-0568
http://www.adligo.com




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 import org.apache.Facetime;
 ApacheCon US 2003, 18-21 November http://apachecon.com/


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


Re: customize exception stack trace output

2003-09-12 Thread Ceki Gülcü
This was discussed as late as yesterday on [EMAIL PROTECTED] See

http://marc.theaimsgroup.com/?t=10632404602&r=1&w=2

In short, in log4j 1.3 you will be able to instruct PatternLayout to use 
your own stack tracing functionality.

At 09:44 AM 9/12/2003 +0200, HANDSCHMANN Robert wrote:
Hi!

I'd like to know the easiest way of customizing the format of printed
exception stacks.
I need a special format for exceptions of specific types.
I tried to subclass ConsoleAppender and overwrote the subAppend method. This
works quite well. But if I choose later to use the RollingFileAppender, I
have to subclass that as well!
Is there a simpler, more straight forward way?
The only thing I want to change is the string representation of the
throwable in a LoggingEvent.
Thanks,
Robert
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


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

2003-09-10 Thread Ceki Gülcü
At 05:40 PM 9/10/2003 +0300, Tarek M. Nabil wrote:
Hi Ceki,

First of all, I'd like to thank you for your response.

When I added the "log4j.debug=true" line and set the MaxBackupIndex to 4, 
everything worked fine.

I'm not really sure what the effect of "log4j.debug=true" is, but my guess 
is, it's to enable internal logging for log4j.
That is correct, log4j.debug=true enables internal logging.

Do you suggest I keep this setting as is and increase the size of each 
backup file? Do large values for MaxBackupIndex cause problems with the 
FileAppender?
Yes, I suggest to increase the size of the backup files and reduce 
MaxBackupIndex.

The MaxBackupIndex should be smaller than 10. However, it should still work 
with larger values. It is quite strange to see nothing happening with 
larger values.

Thanks again.

Tarek Nabil

-----Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 9:38 PM
To: Log4J Users List
Subject: Re: REPOST: RollingFileAppender does not create backups on
WebSphere 5 on Windows


Hello Tarek,

Try using a smaller MaxBackupIndex, say 3 or 4.

Also add the line

log4j.debug=true

to you config file. Once you have made these changes, please report the
output you obtain.
At 09:27 PM 9/9/2003 +0300, you wrote:
>Hi,
>
>I hope someone can help me with this, really.
>
>-Original Message-
>From: Tarek M. Nabil
>Sent: Thursday, September 04, 2003 8:06 PM
>To: [EMAIL PROTECTED] Apache. Org (E-mail)
>Subject: RollingFileAppender does not create backups
>
>
>Hi everyone,
>
>I'm having a problem with the RollingFileAppender on WebSphere 5.0 for
>Windows.
>
>My problem is that, although I have specified 20 backup files, I never get
>any backups. The moment the file reaches the maximum size, it's deleted
>and a new one created (I guess, as the older one disappears).
>
>I looked in the server logs, but didn't find any error messages.
>
>Here's my log4j.properties file
>
>
>log4j.rootLogger=DEBUG, FILE
>
># FILE is set to be a FileAppender which outputs to a file.
>log4j.appender.FILE=org.apache.log4j.RollingFileAppender
>
># IMPORTANT: Change the location of the log file.
>log4j.appender.FILE.File=E:\\Program
>Files\\WebSphere\\AppServer\\logs\\server1\\charm.log
>log4j.appender.FILE.Append=True
>log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
>log4j.appender.FILE.layout.ConversionPattern=%-5p %d %-25c - %m%n
>
># This will prenvent logs with a priority less than ERROR to be logged to
>the file
>log4j.appender.FILE.Threshold=DEBUG
>log4j.appender.FILE.MaxFileSize=10MB
>
># Keep 20 backup files
>log4j.appender.FILE.MaxBackupIndex=20
>
>I previously had a problem that log4j didn't work at all, and I was guided
>by someone on the list that it's because of Java security and that I had
>to create a was.policy file. I did that and log4j worked but I still have
>the previously mentioned problem.
>
>Here's my was.policy file.
>
>/* AUTOMATICALLY GENERATED ON Sun Jul 27 17:14:12 EEST 2003*/
>/* DO NOT EDIT */
>
>grant codeBase "file:${application}" {
>   permission java.lang.RuntimePermission "getClassLoader";
>   permission java.io.FilePermission "<>", "read, write,
> delete, execute";
>};
>
>Any suggestions?
>
>Tarek M. Nabil
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
  For log4j documentation consider "The complete log4j manual"
  ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
  See you in November at ApacheCon US 2003 in Las Vegas.
  http://apachecon.com/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: REPOST: RollingFileAppender does not create backups on WebSphere 5 on Windows

2003-09-09 Thread Ceki Gülcü
Hello Tarek,

Try using a smaller MaxBackupIndex, say 3 or 4.

Also add the line

log4j.debug=true

to you config file. Once you have made these changes, please report the 
output you obtain.

At 09:27 PM 9/9/2003 +0300, you wrote:
Hi,

I hope someone can help me with this, really.

-Original Message-
From: Tarek M. Nabil
Sent: Thursday, September 04, 2003 8:06 PM
To: [EMAIL PROTECTED] Apache. Org (E-mail)
Subject: RollingFileAppender does not create backups
Hi everyone,

I'm having a problem with the RollingFileAppender on WebSphere 5.0 for 
Windows.

My problem is that, although I have specified 20 backup files, I never get 
any backups. The moment the file reaches the maximum size, it's deleted 
and a new one created (I guess, as the older one disappears).

I looked in the server logs, but didn't find any error messages.

Here's my log4j.properties file

log4j.rootLogger=DEBUG, FILE

# FILE is set to be a FileAppender which outputs to a file.
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
# IMPORTANT: Change the location of the log file.
log4j.appender.FILE.File=E:\\Program 
Files\\WebSphere\\AppServer\\logs\\server1\\charm.log
log4j.appender.FILE.Append=True
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%-5p %d %-25c - %m%n

# This will prenvent logs with a priority less than ERROR to be logged to 
the file
log4j.appender.FILE.Threshold=DEBUG
log4j.appender.FILE.MaxFileSize=10MB

# Keep 20 backup files
log4j.appender.FILE.MaxBackupIndex=20
I previously had a problem that log4j didn't work at all, and I was guided 
by someone on the list that it's because of Java security and that I had 
to create a was.policy file. I did that and log4j worked but I still have 
the previously mentioned problem.

Here's my was.policy file.

/* AUTOMATICALLY GENERATED ON Sun Jul 27 17:14:12 EEST 2003*/
/* DO NOT EDIT */
grant codeBase "file:${application}" {
  permission java.lang.RuntimePermission "getClassLoader";
  permission java.io.FilePermission "<>", "read, write, 
delete, execute";
};

Any suggestions?

Tarek M. Nabil

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: DOMConfigurator and CategoryFactory - sources?

2003-09-09 Thread Ceki Gülcü
The log4j-user list blocks certain types of attachments. What type were they?

At 03:37 PM 9/9/2003 +0200, you wrote:
Hello,

oops, it looks as if the attached sources (3 files) didn't make it...
Does the mailing list server perhaps block attachments?
Is there another way to post these sources (except copying the
code in the mail itself...)?
Anyway, I try to attach them to this mail again and hope it
works this time...
Cheers,
Wolfram
--
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: swithing appenders at runtime without losing log messages

2003-09-05 Thread Ceki Gülcü
That is quite an interesting problem. Without thinking about it too
much, I think your best bet to extend an appender so that it can
replace itself with another. For example, see the source code of
org.apache.log4j.varia.FallbackErrorHandler which performs a similar task.
At 03:02 PM 9/5/2003 -0400, you wrote:
Hello,

My organization is switching to log4j. I implemented an extension to the old
logging package so that I could switch the log message destinations (two
files)
back and forth. Now I need to do the same with log4j.
Here is what I did, please let me know if this will work, or any better
ways.
1) extended Logger

public class RecoverLog4jLogger extends Logger {

RecoverLog4jLogger(String name) {
super(name);
}
synchronized public void replaceAppender(Appender oldAppender, Appender
newA
ppender) {
super.removeAppender(oldAppender);
super.addAppender(newAppender);
}
}
2) implemented custom LoggerFactory

class RecoverLog4jFactory implements LoggerFactory {

RecoverLog4jFactory() {
}
public RecoverLog4jLogger makeNewLoggerInstance(String name) {
return new RecoverLog4jLogger(name);
}
}
The idea is upon receiving request to switch log file, the 'replaceAppender'
will
be called. By grouping the 'removeAppender' and 'addAppender' together, I
hope
message won't get lost (or duplicated), since there is a single lock and
single
lock acquire/release by doing this.
Two questions:
1) Will this guarantee no lost message or duplicated message?
2) Will the 'replaceAppender' API be generally useful? If so, can that make
into
   the log4j framework per se?
Thanks for your help.

Glenn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


RE: Problem with Crimson parser

2003-09-05 Thread Ceki Gülcü
Apologies for not responding to your patch earlier. I've found it a will 
respond shortly on log4j-dev.

At 05:34 PM 9/4/2003 -0400, [EMAIL PROTECTED] wrote:
Ceki,

Thank you - that fixed my problem!  The characters 0xEFBBBF are the UTF-8 
Byte Order Mark that is part if the unicode standard.  Apparently, Crimson 
can't handle UTF-8 while Xerces can.

On another topic, do you if there any is interest in the patch I 
contributed to fix the LoggerFactory bug reported as 21707? 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21707)

Thanks,
Mark
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: J2SE 1.5, java.util.logging

2003-09-05 Thread Ceki Gülcü
Sean,

Thanks for this valuable info.

At 11:08 AM 9/5/2003 -0700, Sullivan, Sean C - MWT wrote:

fyi

--
From: Calvin Austin at sun
Hi Sean

There weren't any significant feature requests for the logging package in
1.5, there are some smaller enhancements and some bug fixing going into the
release
regards
calvin
> "Sean C. Sullivan" wrote:
>
>
> Regarding J2SE 1.5...
>
> Will there be any significant enhancements to the
> java.util.logging package?
>
> If so, when will these enhancements be available for public review?
>
> -Sean
>
--

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


RE: Problem with Crimson parser

2003-09-04 Thread Ceki Gülcü
The first three bytes in of the config file are (in hex) EF BB BF instead 
of "

Your file looks OK otherwise. Just remove the first 3  bytes to keep 
Crimson happy.

At 02:12 PM 9/3/2003 -0400, [EMAIL PROTECTED] wrote:
Ceki,

I tried initializing with a sample xml config file from the distribution 
and it works fine with Crimson.  I tried playing around with DOCTYPE and 
other preamable elements in my document but I could not get it to work.  I 
have attached my config file to this email in case you can figure out what 
is wrong with it.

Thanks,
Mark
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


RE: Problem with Crimson parser

2003-09-04 Thread Ceki Gülcü
Can be it that the file has the wrong line separators?

At 02:12 PM 9/3/2003 -0400, you wrote:
Ceki,

I tried initializing with a sample xml config file from the distribution 
and it works fine with Crimson.  I tried playing around with DOCTYPE and 
other preamable elements in my document but I could not get it to work.  I 
have attached my config file to this email in case you can figure out what 
is wrong with it.

Thanks,
Mark


-Original Message-
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 12:59 PM
To: Log4J Users List
Subject: Re: Problem with Crimson parser
Mark,

Can you please provide the XML file causing trouble?

The commit you mention is also available in 1.2.8. (that is why I asked if
you were using 1.2.8.).
At 06:00 PM 9/2/2003 -0400, [EMAIL PROTECTED] wrote:
>Hi,
>
>I am having trouble parsing my config file with DOMConfigurator using
>Crimson.  I have no problems with Xerces but when I use crimson I get the
>exception at the end of this message.
>
>Somehow, Crimson is not able to find the dtd using the SYSTEM identifier
>log4j.dtd.  I noticed there was a recent commit that added a class
>UtilLoggingEntityResolver.java with the following comment:
>
> // we change the system ID to a valid URI so that Crimson won't
> // complain. Indeed, "log4j.dtd" alone is not a valid URI which
> // causes Crimson to barf. The Log4jEntityResolver only cares
> // about the "log4j.dtd" ending.
>
>Is there a work-around I can use for Crimson without having to use the
>latest CVS code?  As an aside I don't think log4j.dtd is an invalid value
>for system identifier.  I just looked in the W3C XML spec and it has an
>example with another such system identifier.
--
Ceki Gülcü
  For log4j documentation consider "The complete log4j manual"
  ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
  See you in November at ApacheCon US 2003 in Las Vegas.
  http://apachecon.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]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: AW: Problems with multiple Threads on DailyRollingFileAppender

2003-09-03 Thread Ceki Gülcü
Look under LOG4J_HOME/contribs/KevinSteppe/ where LOG4J_HOME is the 
directory where you unpacked the log4j distribution.

At 06:43 PM 9/3/2003 +0200, you wrote:
Ok,
I'll try it, but can you tell me where I can find the 
CompositeRollingFileAppender, i had it some time ago, but then deleted it. 
And is it compatible with Log4j 1.2. Thought there were Problems cause it 
was written for 1.1.x or is there a "new" version of the 
CompositeRollingFileAppender available ?

-Ursprüngliche Nachricht-
Von: Abramson, Rami [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 3. September 2003 18:09
An: 'Log4J Users List'
Betreff: RE: Problems with multiple Threads on DailyRollingFileAppender
Use the CompositeRollingFileAppender, and set its 'RollingStyle' value to 3.

all the best,

Rami

-Original Message-
From: Bansemir, Carsten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 2:22 PM
To: Log4J Users List
Subject: AW: Problems with multiple Threads on DailyRollingFileAppender
I found a solution: DailyRollingFileAppenderExt does exactly what I want,
but now I have another Problem:
I want to roll over the logfile also when it becomes to large, but only the
RollingFileAppender can do this. I then found an Appender called
CompositeRollingFileAppender, but then I get the old problem back (because
CompositeRollingFileAppender uses the default behaviour of
DailyRollingFileAppender). So can anyone tell me how I (easily) can add the
functionality of RollingFileAppender to the DailyRollingFileAppenderExt ?
(I know there will be strategy based rollovers in the future (do you know
when?) , but i need this functionality now)
-Ursprüngliche Nachricht-
Von: Bansemir, Carsten
Gesendet: Mittwoch, 3. September 2003 10:18
An: [EMAIL PROTECTED]
Betreff: Problems with multiple Threads on DailyRollingFileAppender
Hi, I have to log from multiple Threads of a big Application, and I want to
use the DailyRollingFileAppender to daily log to a new file. My Problem is
that some Threads log to the old files (yesterday logfile) instead of the
new ones. I'm using a LogFileRoller wich guarantees that the logfile rolls
at midnight (a Cron Job wich logs to every Logfile once at midnight). I
searched the mailing list, and found out that there are Problems with the
DailyRollingFileAppender when there are Threads wich block the files, so
that the System isn't able to rename the files (especially under Windows
OS). The Suggestion was to stop and re-run the application, but that won't
work here, because our Application is running in production, and it's not
possible to stop the application.
Has anybody therefor wrote an own Version of DailyRollingFileAppender that
doesn't uses the critical (at least on Windows Systems) Java Methods
(File.renameTo()) or which does the RollOver on a completely different way ?
I am using log4j 1.2.5 with the SUN jdk1.2.2 of Visual Age for Java or
jdk1.3.1_08 under WSAD.
Running OS: Windows NT4


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
NOTICE: This communication contains information which may be proprietary,
privileged or confidential. If you are not the intended recipient (or
authorized to receive for the intended recipient), or believe that you have
received this communication in error, please do not print, copy, retransmit,
disseminate, disclose or otherwise use the information. Also, please
indicate to the sender that you have received this communication in error
and delete the copy you received. 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]
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: Problem with Crimson parser

2003-09-03 Thread Ceki Gülcü
Mark,

Can you please provide the XML file causing trouble?

The commit you mention is also available in 1.2.8. (that is why I asked if 
you were using 1.2.8.).

At 06:00 PM 9/2/2003 -0400, [EMAIL PROTECTED] wrote:
Hi,

I am having trouble parsing my config file with DOMConfigurator using 
Crimson.  I have no problems with Xerces but when I use crimson I get the 
exception at the end of this message.

Somehow, Crimson is not able to find the dtd using the SYSTEM identifier 
log4j.dtd.  I noticed there was a recent commit that added a class 
UtilLoggingEntityResolver.java with the following comment:

// we change the system ID to a valid URI so that Crimson won't
// complain. Indeed, "log4j.dtd" alone is not a valid URI which
// causes Crimson to barf. The Log4jEntityResolver only cares
// about the "log4j.dtd" ending.
Is there a work-around I can use for Crimson without having to use the 
latest CVS code?  As an aside I don't think log4j.dtd is an invalid value 
for system identifier.  I just looked in the W3C XML spec and it has an 
example with another such system identifier.
--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: Problem with Crimson parser

2003-09-03 Thread Ceki Gülcü
Mark,

You are not using log4j version 1.2.8 are you? If you are not, please retry 
with 1.2.8.

At 06:00 PM 9/2/2003 -0400, [EMAIL PROTECTED] wrote:
Hi,

I am having trouble parsing my config file with DOMConfigurator using 
Crimson.  I have no problems with Xerces but when I use crimson I get the 
exception at the end of this message.

Somehow, Crimson is not able to find the dtd using the SYSTEM identifier 
log4j.dtd.  I noticed there was a recent commit that added a class 
UtilLoggingEntityResolver.java with the following comment:
[snip]

--
Ceki Gülcü
 For log4j documentation consider "The complete log4j manual"
 ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
 See you in November at ApacheCon US 2003 in Las Vegas.
 http://apachecon.com/


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


Re: log4j.xml Help

2003-09-01 Thread Ceki Gülcü
At 10:40 AM 8/29/2003 -0700, Rhugga wrote:

Also, just the book you can buy from the log4j site cover the XML stuff 
pretty well?
One can say with confidence that the XML configuration format is covered in 
great detail. The manual contains many example config files in both XML and 
properties (key=value) format. Some of the examples are in XML format only 
because the properties format does not support all the features supported 
by the XML format.


Thanks,
CC
--
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]


Re: Fwd: Log4J400 - Appender for IBM AS/400 MessageQueue and DataQueue

2003-08-29 Thread Ceki Gülcü
Gurkha,

Done. Please let me know if you would like to change the text.

At 10:56 AM 8/29/2003 -0400, you wrote:
Who can I contact to get this appender listed on Log4J homepage?

Regards
Gurkha
Hello,

I have written appenders for the AS/400 (aka IBM iSeries) MessageQueue 
and DataQueue. Due to dependencies, I cannot submit it to the Apache 
Log4J project. I have hosted the project on SourceForge.

I request you to consider adding it to the the download page under the 
third party extensions section.

The link to the Log4J400 website is
http://log4j400.sourceforge.net/
Regards,
Gurkha
--
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]


Re: Behaviour in Log4j when Logfile is deleted.

2003-08-29 Thread Ceki Gülcü
Reopening the file? That is an interesting suggestion. Instead of
reopening at each write, one could close and reopen the file every
10'000 writes or every 10 minutes which is ever comes first.
At 02:07 PM 8/29/2003 +0100, you wrote:
(I didn't see the original message, so forgive me if this is not relevent...)

If you delete a file under Unix, the Java program will still have a "handle"
to it and can't detect whether the file has been deleted externally.  A
workaround would be to reopen the file for every write, which would be
dreadful for performance.
--
Fergus Gallagher  Tel: +44 (20) 8742 1600
--
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]


RE: Class FileWatchdog

2003-08-29 Thread Ceki Gülcü


The watchdog code in log4j 1.2.x does not have a notion of a
lifecycle. In particular, LogManager.shutdown does not stop the
watchdog thread.  Actually, I don't think there is a way to stop a
watchdog thread which is definitely a serious shortcoming of log4j
watchdogs.
This omission can prevent dead classloaders from being garbage
collected in web-containers.
For example see:

 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22478

Thus, my recommendation would be to avoid using watchdogs for the time being
in J2EE environments.
At 08:59 AM 8/29/2003 -0400, Shapira, Yoav wrote:

Howdy,
You use it all the time if you do configureAndWatch() for log4j.  It has
a concrete implementation as well, I think (PropertyWatchdog or
something like that).  The name of the class pretty much explains it:
watch over a file and fire an event if the file changes.  It's a common
pattern with dozens of implementations all over the place.
Yoav Shapira
Millennium ChemInformatics
>-Original Message-
>From: Raveendranath, Rohith (LNG - AUS)
>[mailto:[EMAIL PROTECTED]
>Sent: Thursday, August 28, 2003 8:46 PM
>To: 'Log4J Users List'
>Subject: Class FileWatchdog
>
>Hi i was looking at the Log4j API's
>
>There is a Abstract class : Class FileWatchdog
>
>has anyone used this ? can any one provide a brief idea abt this class
plzz
>?
>
>Thanks in Advance
>Rohith
>
>-Original Message-
>From: Raveendranath, Rohith (LNG - AUS)
>[mailto:[EMAIL PROTECTED]
>Sent: Friday, 29 August 2003 10:30 AM
>To: 'Log4J Users List'
>Subject: RE: Behaviour in Log4j when Logfile is deleted.
>
>
>whetrher logging activity is critcal for any application will be the
>guiding
>factor to decide whether the application should crash i case of logging
>failure.
>
>Morover what iam asking is should't a warning be thrown on the console
>saying that the logging cannot be proceeded or so
>
>
>
>-Original Message-
>From: Charles Hudak [mailto:[EMAIL PROTECTED]
>Sent: Friday, 29 August 2003 10:23 AM
>To: 'Log4J Users List'
>Subject: RE: Behaviour in Log4j when Logfile is deleted.
>
>
>log4j is fail stop. Logging doesn't and shouldn't throw an exception to
>your
>application and cause it to crash.
>
>-Original Message-
>From: Raveendranath, Rohith (LNG - AUS)
>[mailto:[EMAIL PROTECTED]
>Sent: Thursday, August 28, 2003 17:12
>To: 'Log4J Users List'
>Subject: Behaviour in Log4j when Logfile is deleted.
>
>
>Hi all,
>
>I am using Lo4j 1.2.8,
>
>During the cource of my application  running i deleted the log file.
Now
>there is no exception/error thrown.
>
>The application keeps on running ,possibly ignoring the logging part.
>
>Whys is this behaviour happening,should the log4j throw exception as
its no
>longer finding the Log File.
>
>Thanks and regards
>Rohith
>
>This e-mail is for the use of the intended recipient(s) only.  If you
have
>received this e-mail in error, please notify the sender immediately and
>then
>delete it.  If you are not the intended recipient, you must not use,
>disclose
>or distribute this e-mail without the author's permission.  We have
taken
>precautions to minimise the risk of transmitting software viruses, but
we
>advise you to carry out your own virus checks on any attachment to this
>e-mail.
>We cannot accept liability for any loss or damage caused by software
>viruses.
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>This e-mail is for the use of the intended recipient(s) only.  If you
have
>received this e-mail in error, please notify the sender immediately and
>then
>delete it.  If you are not the intended recipient, you must not use,
>disclose
>or distribute this e-mail without the author's permission.  We have
taken
>precautions to minimise the risk of transmitting software viruses, but
we
>advise you to carry out your own virus checks on any attachment to this
>e-mail.
>We cannot accept liability for any loss or damage caused by software
>viruses.
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>This e-mail is for the use of the intended recipient(s) only.  If you
have
>received this e-mail in error, please notify the sender immediately and
>then
>delete it.  If you are not the intended recipient, you must not use,
>disclose
>or distribute this e-mail without the author's permission.  We have
taken
>precautions to minimise the risk of transmitting software viruses, but
we
>advise you to carry out your own virus checks on any attachment to this
>e-mail.
>We cannot accept liability for any loss or damage caused by software
>viruses.
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>This e-mail is for the use of the intended recipient(s) only.  If you

RE: Behaviour in Log4j when Logfile is deleted.

2003-08-29 Thread Ceki Gülcü
Log4j will never throw an exception through its printing methods 
(Logger.debug(), Logger.info(), ...). However, it will print a warning 
message on the console. That is the default behavior which can be 
customized using error handlers.

It is entirely possible for the Java io API to silently ignore the fact 
that the file is gone. That is a Java issue and log4j cannot do anything 
about it.

At 10:29 AM 8/29/2003 +1000, Raveendranath, Rohith (LNG - AUS) wrote:
whetrher logging activity is critcal for any application will be the guiding
factor to decide whether the application should crash i case of logging
failure.
Morover what iam asking is should't a warning be thrown on the console
saying that the logging cannot be proceeded or so
--
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]


Re: config file reloading

2003-08-28 Thread Ceki Gülcü
Two short comments.

1) My name is Ceki not Ciki.
2) You can use LogManager.resetConfiguration() to reset or clear the 
existing config before you read the new config file.

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]


RE: Log file location

2003-08-28 Thread Ceki Gülcü
Yes, that is possible by using attaching an appender to com.mypackage and 
setting appender additivity to false.

Please refer to log4j documentation at

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

At 08:09 PM 8/28/2003 +0530, you wrote:
Yes, I have done that and it's working.

I have used log4j.xml of jboss (located in server/default/conf).
I have added by own category in that:

   

So, all ERROR level messages generated in mypackage are written to server.log.

But this server.log contains all the info that is being logged by JBoss by 
default also (I mean all the JBoss log information also is included in 
this server.log apart my application log).

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.





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

RE: Log file location

2003-08-28 Thread Ceki Gülcü
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://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&#x

Re: SizeBasedTriggeringPolicy $ TimeBasedRollingPolicy

2003-08-28 Thread Ceki Gülcü
Hello Delphina,

TimeBasedRollingPolicy is somewhat special. It is declared as:

public class TimeBasedRollingPolicy extends RollingPolicySkeleton
  implements TriggeringPolicy {
}
Thus, it combines both a rolling policy and a triggering policy. Look at 
the tests cases under /tests/src/o/a/log4j/rolling to see how it is used.

I think you should first study TimeBasedRollingPolicy and then either 
create a new class based on TimeBasedRollingPolicy or extend 
TimeBasedRollingPolicy overriding the isTriggeringEvent method.

Let me know if this helps,

At 11:09 AM 8/28/2003 +0200, Delfina Concepcion wrote:
Hi all!
I'm getting started with log4j programming and i have my first doubt.
I want a logger size based triggering policy and time based rolling policy 
so i'm using SizeBasedTriggeringPolicy and TimeBasedRollingPolicy in the 
following way:

Logger root = Logger.getRootLogger();
root.addAppender(new ConsoleAppender(new PatternLayout()));
PatternLayout layout = new PatternLayout("%c{1} - %m%n");
RollingFileAppender rfa = new RollingFileAppender();
rfa.setLayout(layout);
TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
SizeBasedTriggeringPolicy sbtp = new SizeBasedTriggeringPolicy();
tbrp.setActiveFileName("my_log");
tbrp.setFileNamePattern("my_log_%d{-MM-dd_HH_mm_ss}");
sbtp.setMaxFileSize(100);
rfa.setRollingPolicy(tbrp);
rfa.setTriggeringPolicy(sbtp);
rfa.activateOptions();
root.addAppender(rfa);
for (int i = 0; i < 200; i++) {
try{
Thread.sleep(1000);
}catch(Exception e){}
if (i > 10) {
logger.debug("Hello " + i);
} else if (i > 100) {
logger.debug("Hello " + i);
}
}
An i get the following error when max size is reached:
The date pattern is [-MM-dd_HH_mm_ss] from file name pattern [my_log_%d{yy
-MM-dd_HH_mm_ss}].
Rollover every second.
getActiveLogFileName called
Active log file name: my_log
Hello 11
Hello 12
Hello 13
Hello 14
About to rollover
rollover called
compressionMode: 0
activeFileName: my_log
currentFileName: null
Exception in thread "main" java.lang.NullPointerException
at java.io.File.(File.java:180)
at org.apache.log4j.rolling.helpers.Util.rename(Util.java:68)
at org.apache.log4j.rolling.TimeBasedRollingPolicy.rollover(TimeBasedR
lingPolicy.java:175)
at org.apache.log4j.rolling.RollingFileAppender.rollover(RollingFileAp
nder.java:124)
at org.apache.log4j.rolling.RollingFileAppender.subAppend(RollingFileA
ender.java:153)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:181)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:27
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppende
(AppenderAttachableImpl.java:100)
at org.apache.log4j.Category.callAppenders(Category.java:253)
at org.apache.log4j.Category.forcedLog(Category.java:464)
at org.apache.log4j.Category.debug(Category.java:317)
at com.foo.Pruebas_log4j.main(Pruebas_log4j.java:101)
I could see TimeBasedRollingPolicy 'changes' the logfile name in method 
isTriggeringEvent but only sizebased triggering event method is invoked as 
is the only triggering policy configured for RollingFileAppender.
Am i wrong or may i overwrite timebasedrollingpolicy to force the change 
of the logfile name when rollover() is invoked?
Thanks for all
--
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]


RE: Log file location

2003-08-28 Thread Ceki Gülcü
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/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://w

Re: Log file location

2003-08-27 Thread Ceki Gülcü
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]


RE: Log file location

2003-08-27 Thread Ceki Gülcü
Sriram,

JBoss already includes log4j. Are you including log4j.jar in WEB-INF/lib? I 
think jboss is ignoring your log4j.jar in WEB-INF/lib because log4j classes 
are already loaded and available. Thus, since your log4j.jar is not being 
loaded into memory, the static initializer of LogManager class is not being 
executed and no automatic configuration occurs.

Which version of jboss are you using?

One possibility is to edit jboss log4j config file in order to add your 
rolling file appender.

At 08:00 PM 8/27/2003 +0530, sriram wrote:
The problem is log4j.properties file not being located...the log output on 
the console is being generated based on default properties of log4j (I assume).

So I am not looking at how to make log4j.properties file visible to the 
application. I placed it in WEB-INF/classes, but there is no use.
--
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]


Re: Bug#22055: Cannot catch PropertyConfigurator's IOException

2003-08-27 Thread Ceki Gülcü
This is a known weakness of the existing log4j configurators which I intend 
to fix in log4j 1.3.

At 10:35 AM 8/27/2003 -0500, Desai, Chetan P [ITS] wrote:
I had posted the following bug but don't know if its truly a bug...
Sorry was not part of this mailing list earlier - so don't have any of the 
replies to my post.

public static void main(String[] args) {
 Logger lg = Logger.getLogger(TestLog.class);
 try{
  PropertyConfigurator.configure("C:\\tmp\\LogProps.txt");
  lg.debug("Done configuring logger");
 }catch(Exception e) {
  System.out.println("Caught Exception: "+e.getMessage());
 }
 System.out.println("After props");
}//end main
If LogProps.txt does not exist or if it has syntax errors within, I cannot
catch those exceptions and take any corrective actions (viz. assuming
defaults).
-Chetan desai.
--
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]


RE: Log file location

2003-08-27 Thread Ceki Gülcü
Given your observation, it is safe to say that your log4j.properties file 
is not being read.

At 07:22 PM 8/27/2003 +0530, sriram wrote:
I look at JBoss log - no errors reported there.
I used log4j.debug=true in log4j.properties, but there is no internal 
debugging output.
I tried various combinations of filename, but none of them worked.

If I specify as follows:
log4j.appender.R.File=errors.log
Where will the log file be created?  I can't find errors.log anywhere. 
What is it that I am doing wrong?

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 6:59 PM
To: Log4J Users List
Subject: RE: Log file location


Howdy,
Look in the JBoss log for errors initializing log4j.  Turn 
-Dlog4j.debug=true to see log4j internal debugging output.  Try different 
paths for your File argument, e.g. d:\jboss\errors.log or d://jboss/errors.log.

Yoav Shapira
Millennium ChemInformatics
>-Original Message-
>From: sriram [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, August 27, 2003 8:56 AM
>To: '[EMAIL PROTECTED]'
>Subject: Log file location
>
>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
>


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


Re: Single Logger, multiple threads

2003-08-27 Thread Ceki Gülcü
Tom,

We have addressed this concurrency problem in log4j version 1.3.

Depending on how you name your loggers, you might have a small gain.

Regardless how much we optimize log4j, calling it thousands, millions
or even billions of times will have a computational cost. My advice to
you would be to use logging wisely. In general, you should avoid
logging statements which can be potentially called thousands of
times. Such statements are a lose-lose proposal. When enabled, they
overwhelm the contents of the logging output; when disabled, they
degrade performance.
HTH,

At 11:28 AM 8/27/2003 +, tom tumb wrote:
Hi all,

We have an application that will be running a large number of theads 
(possibly 50) and currently we are using only a single Logger object 
across all these threads. I am wondering if this will lead to some 
performance issues (i.e. a thread waiting while another thread uses the 
logger) and would our logging performance improve if we had more logger 
objects.

I have read some other messages on the mailing list and currently I am of 
the opinion that increasing the number of logger objects will not improve 
performance.  We only have a single appender (which writes to a file) and 
as the synchronisation is carried out on this appender object rather then 
the logger object then increasing the number of logger objects should not 
improve logging performance as each thread will still obtain a lock at the 
same point.

I have looked at the source code for the Logger class and it seems that 
the callAppenders method does lock the Logger object however I am not sure 
how this should influence my decision of whether or not to increase the 
number of loggers.

All help appreciated,
Tom
--
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]


Re: Location of log files with Tomcat

2003-08-25 Thread Ceki Gülcü
I think there is an easier way. You can use log4j's variable
substitution mechanism:
All option values admit variable substitution. The syntax of variable
substitution is similar to that of Unix shells. The string between an
opening "${" and closing "}" is interpreted as a key. The value of the
substituted variable can be defined as a system property or in the
configuration file itself. The value of the key is first searched in
the system properties, and if not found there, it is then searched in
the configuration file being parsed. The corresponding value replaces
the ${variableName} sequence. For example, if java.home system
property is set to /home/xyz, then every occurrence of the sequence
${java.home} will be interpreted as /home/xyz.
HTH,

At 09:20 AM 8/25/2003 +0100, Louise Pryor wrote:
My web site is on a shared host, so I don't have access to the
$CATALINA_HOME/logs directory. In fact, I don't even know where the
host thinks the directory of my web site is (I see it as being in
~/public_html  ). I'm using log4j as my logging mechanism (directly
rather than through commons logging) and have some code in an
initialization servlet  that goes through the log4j.properties file
making all the file locations be relative to my web app directory. The
code is listed below.
My questions are:
- Is this a reasonable way of doing things?
- Is there a better way?
Thanks for any help on this

Louise
--
Louise Pryor
http://www.louisepryor.com


public void init() {
String prefix = getServletContext().getRealPath("/");
String file = getInitParameter("log4j-init-file");
Properties props = new Properties();
Enumeration enum;
String pName, pVal;
if (file != null) {
try {
FileInputStream istream = new FileInputStream(prefix+file);
props.load(istream);
istream.close();
}
catch (IOException e) {
LogLog.error("Could not read configuration file ["+
 prefix+file+"].", e);
LogLog.error("Ignoring configuration file [" +
 prefix+file+"].");
return;
}
// go through the properties looking for appender files.
// add the prefix onto them
for ( enum = props.propertyNames(); enum.hasMoreElements(); ) {
pName = (String ) enum.nextElement();
if ( pName.startsWith("log4j.appender.") &&
 pName.endsWith(".File")) {
pVal = props.getProperty(pName);
props.setProperty(pName, prefix+pVal);
} // end of if ()
} // end of for ()
PropertyConfigurator.configure(props);

} else {
BasicConfigurator.configure();
}
}
--
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]


Re: Why is ThrowableInformation transient in LoggingEvent?

2003-08-25 Thread Ceki Gülcü
Thomas ,

The throwables do not preserve the stack trace after serialization, so they 
are useless on the server side. That is why the throwable variable is 
transient. However, there is another variable, throwableInfo, which 
preserves stack trace information after serialization.  By the way, we are 
talking about stack traces of exceptions, right?



At 07:59 AM 8/25/2003 +0200, Thomas Svensen wrote:
Hi fellow "loggers"!

I am setting up a logging scheme where a number of "satelite systems" report
logging events via sockets to a central logger. I will only send events
about a certain level, e.g. ERROR.
This was very easy and simple to set up, but one problem arose: I couldn't
see the stack trace in the central logger. I read the javadoc and found the
following under LoggingEvent:
 javadoc start --

public ThrowableInformation getThrowableInformation()
Returns the throwable information contained within this event. May be null
if there is no such information.
Note that the Throwable object contained within a ThrowableInformation does
not survive serialization.
 javadoc end --

Why has ThrowableInformation been declared transient? For performance
reasons? Is there a simpler solution to this than writing my own
LoggingEvent and other required classes?
Thanks for any feedback on this :-)

Thomas Svensen
-
System Developer
Cellus Norway
mailto:[EMAIL PROTECTED]
fixed line: (+47) 23 23 44 25
mobile: (+47) 918 23 480


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


Re: NullPointerException

2003-08-23 Thread Ceki Gülcü
Jeff,

The text of your question is not very clear, at least to me. Are you 
observing a logging problem or a problem with the application itself?

Which version of the JDK are you using?

By the looks of your stack trace, it seems that log4j is trying to log an 
exception. Let us call this exception E0. From what I could gather from 
your message, it seems E0's stack trace is empty. This causes log4j to 
throw the NullPointer exception included in your message. Log4j does not 
expect an exception with an empty stack trace and barfs a NullPointer.

Would it be possible for you to provide more information on E0, for example 
a stack trace of E0?

Thanks in advance,

At 12:41 PM 8/22/2003 -0500, [EMAIL PROTECTED] wrote:
Sorry for the broad question but was wondering if any has something
similar.
We are using jboss-3.0.4_tomcat-4.0.6 bundle and sending our appliction
logs to it's internal log4j.
I know this may be a Jboss issue but...

We throw our own Exception from a session EJB and end up catching it in the
Struts Layer, logging the error and displaying a message based on the
resource key supplied in the Root Exception.  We do this type of thing
throughout the application with out a problem.
At some point a NullPointerException is thrown that overrides the original
exception.
I have isolated to the logging area because if shut off logging (set the
level to FATAL) the problem goes away and we see the expected message.
Has anyone seen this before?

java.lang.NullPointerException
  at java.io.Writer.write(Writer.java:126)
  at org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:39)
  at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:299)
  at org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
  at 
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
  at 
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
  at org.apache.log4j.Category.callAppenders(Category.java:187)
  at org.apache.log4j.Category.forcedLog(Category.java:372)
  at org.apache.log4j.Category.log(Category.java:834)
  at org.jboss.logging.Logger.info(Logger.java:158)
  at 
org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:391)
  at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
  at 
org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:380)
  at org.jboss.ejb.Container.invoke(Container.java:712)
  at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
  at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
  at 
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
  at 
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
  at 
org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
  at 
org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:117)
  at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
  at $Proxy656.saveCurrentTransferAdjustment(Unknown Source)
  at 
com.nlg.ar.common.interfaces.ArServiceImpl.saveCurrentTransferAdjustment(ArServiceImpl.java:1260)
  at 
com.nlg.ar.web.customer.action.CustomerAdjSaveTransferAction.executeAction(CustomerAdjSaveTransferAction.java:45)
  at 
com.nlg.ar.web.common.action.ArAuthenticatedAction.execute(ArAuthenticatedAction.java:56)
  at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
  at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
  at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1349)
  at 
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:507)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
  at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:431)
  at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:355)
  at 
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1033)
  at 
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:283)
  at 
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:436)
  at 
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:326)
  at 
org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
  at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
  at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1349)
  at 
org.apache.struts.action.ActionSe

Re: LoggingEvent MDC

2003-08-23 Thread Ceki Gülcü
OK, I see now. This problem has already been solved in the latest code. See 
LoggingEvent.getMDCKeySet method

http://cvs.apache.org/viewcvs.cgi/jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java

HTH,

At 03:57 PM 8/22/2003 -0400, Don Isenor wrote:
Thanks, but I don't think that will do it for me... I'm using a JMS 
appender to send LoggingEvents from a servlet to a message driven bean. 
The bean will log the event to a database. Of course, I want to log the 
servlet's MDC (contained in the Logging Event), not the bean's.
MDC.getContext only gets me the bean's Hashtable.

Ceki Gülcü wrote:
--
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]


Re: LoggingEvent MDC

2003-08-22 Thread Ceki Gülcü
Don,

You can use MDC.getContext which returns the Hashtable where the data is 
stored. You can get the keys from there.

I also added MDC.getKeys to the most recent code in our CVS repository.

HTH,

At 12:47 PM 8/22/2003 -0400, Don Isenor wrote:
I need to extract the MDC key/value pairs from a LoggingEvent. I'd like to 
iterate through the list of keys, but there seems to be no method for 
getting such a list. Does anyone know how I might accomplish this? I don't 
know the key names in advance, so LoggingEvent.getMDC() is of no use to me.

Thanks,
Don Isenor
ePocket Inc.
[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]


  1   2   3   4   5   6   7   8   9   10   >