Re: Best Place to place log files

2011-02-05 Thread Thorbjørn Ravn Andersen

Den 05/02/11 08.35, Umesh Awasthi skrev:

my question is in such case what is the best place to store your application
related log files?
For running inside GlassFish I found that the simplest way was to 
channel the log events to java.util.logging which GlassFish both handles 
and provide a web interface for.  From log4j you can either write an 
appender mapping to java.util.logging, or use slf4j modules to channel 
log4j->slf4j->java.util.logging.


--
  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Omit xml part

2010-11-02 Thread Thorbjørn Ravn Andersen

Den 02/11/10 10.25, Alexander Curvers skrev:

Hello,

i send some binary data in xml messages with my webservices.. I log 
all communication for debugging purposes. The problem is the binary 
value gets logged as well making the log very big.. I want to log the 
rest of the xml but just not the one field/property containing the 
binary data.. can i configure Log4j to just not log that line/property 
of the xml message?


Not immediately, but you can use the XSLT implementation available in 
the Java Runtime to remove the binary value from your XML before logging it.


--
  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: locating my log4j.properties file

2010-10-09 Thread Thorbjørn Ravn Andersen

 Den 08/10/10 00.39, Don Raikes skrev:

Hello,

I have a java project which I compile and then package in a jar file which goes 
into my jdk_home\jre\lib\ext folder (it is an extension to my jdk).
I would recommend against using the extension mechanism as this changes 
the global behaviour of this JDK which may cause _other_ Java programs 
using this JDK to unexpectantly change behaviour causing bugs that can 
be very hard to find.


What is the reason for you not just having an extra jar in your classpath?

--
  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Problem with linux

2010-04-27 Thread Thorbjørn Ravn Andersen

Den 27/04/10 15.37, Vijayakumar skrev:

I see all INFO and DEBUG messages in local windows system, while I move my 
application to linux system I see only the very first line of the log message, 
rest of the line are not displayed.
What might be the problem, kindly help me out.
   

Use Wordpad instead of Notepad to view the log file.

--
  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Tomcat 6 and log4j 1.2.14 - Why No Web Application Logging?

2010-03-31 Thread Thorbjørn Ravn Andersen

Den 31/03/10 21.22, Egan, David skrev:

Following the instructions from here: 
http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j.
specifically the end 2nd last paragraph about config web application logging.


My application (SOAP service) runs successfully AND logs when I run locally on 
my Window Tomcat 6 instance (both to console and log file specified in 
log4j.properties).

Migrate the SAME war file to Solaris test environment, with same
 WEB-INF/classes/log4j.properties file
 WEB-INF/lib/log4j-1.2.14.jar

When migrated to our Solaris environment running same version of Tomcat 
(6.0.24) absolutely no logging occurs.  Nothing showing in console log nor in 
log file specified.  It's as if it's going completely to /dev/null
   
Check if you have Windows file paths instead of Unix file paths in your 
configuration file.


Use lsof (if available) to see which files are actually open.

--

  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: High CPU usage impact to log4j

2009-06-24 Thread Thorbjørn Ravn Andersen

Arica skrev  den 24-06-2009 08:22:

90% CPU usage. I really want to know that my JVM is doing...I know I can do
hanks.
  

Attach to the JVM with jvisualvm (available in the Java 6 JDK)

--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j v1.2.14 compatible with Java 1.6?

2009-06-09 Thread Thorbjørn Ravn Andersen

Lesley Tay skrev  den 10-06-2009 04:45:

By weird I mean null characters being printed out to the log at random times:
  

Do these random times coincide with the machines being booted?

--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Call for feedback

2009-04-28 Thread Thorbjørn Ravn Andersen

Roberto Blanc skrev  den 25-04-2009 19:00:

while doing its job. It has the unique value of adding this
tamper-evident "digital fingerprint" at the record level, which is
impossible using other means such as digital signatures.
  
Interesting.  Could you explain how this tamper-evident fingerprinting 
works?


--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Processing XML log files generated using log4j

2009-03-27 Thread Thorbjørn Ravn Andersen

sasuke skrev  den 24-03-2009 05:58:

It would be appreciated if someone could suggest a simpler and less painful
approach for this problem.
  
Try having a look at the Microsoft LogParser which allow you to query 
the XML with a SQL-like syntax. 

Also the Apache Chainsaw and Lilith logviewers allow you to read in 
these XMl snippets and see them.


--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Can't get basic Zeroconf example to work.

2009-01-21 Thread Thorbjørn Ravn Andersen

Paul Smith skrev  den 21-01-2009 03:55:
I now notice that JmDns has a 2.0 available, which is probably the 
issue here.  Could you download 1.0 and replace it (looking at 
sourceforge, they don't appear to publish older jars, weird, if you 
like I can send you the jmdns 1.0 jar in a separate, direct email)?  I




You're definitely using 2.0, I get that same problem.  See [1] below 
with the diff to the log4j-zeroconf that will make it compatible with 
JmDNS 2.0, however this upgrade comes with the side affect that the 
JmDNS 2.0 jar is compiled with 1.6 source/binary compatibility.  If we 
upgraded log4j-zeroconf to use JmDNS 2.0, that would effectively 
mandate it to also require 1.6 (currently you can get it to work on 
JRE 1.2).
I have just played around with some old code which previously worked 
with Chainsaw Zeroconf (guaranteed jmdns 1.0), and it did not show up in 
the zeroconf window when starting Chainsaw over webstart (which reports 
Zeroconf to be available - perhaps it uses Bonjour 1.0.6?) so I've 
probably done something wrong.


I am aware that this is is not the same issue as the one reported in 
this thread, but I would really like to ask if you could create a simple 
"run me to test zeroconf"-application which could also be run over 
webstart so it is very simple to run these two applications next to each 
other and see that stuff works?


That would be really great :)  Thanks a lot if you do :)

Regards,

--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: SocketHubAppender can not bind on Solaris?

2008-12-02 Thread Thorbjørn Ravn Andersen

AJ Weber skrev  den 02-12-2008 14:08:
I used netstat to check if the port was in-use.  Then I attempted to 
connect to that port via telnet (with the port number).  No response.  
But when I start the SocketHubAppender it gets the address already in 
use error.

What exactly does "No response" mean?

To ensure stuff works you need a "Connection refused" response to the 
telnet.


--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


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



Re: SocketHubAppender can not bind on Solaris?

2008-12-02 Thread Thorbjørn Ravn Andersen

AJ Weber skrev  den 02-12-2008 05:51:

I'm trying to startup a SocketHubAppender on Solaris 9.  All my other, 
local/file logging works great.

  I check if a port is in-use, and find an open one -- take 12001 for example.

  

How do you find an open one?

I can recommend running nmap against the machine.


  So I configure my appender and port, then try starting my java application.  
But it almost immediately comes back with a java.net.BindException: Address 
already in use!  But it wasn't a second ago!  Is this a Solaris-specific 
problem anyone has seen before?  I think the host may be using NIS+, could that 
be blocking my binding to it?
  
Perhaps you should learn to use the Solaris version of netstat as it can 
tell you who sits on the port.  It might also be a permission problem? 


--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


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



Re: Error while loading OracleDriver

2008-11-19 Thread Thorbjørn Ravn Andersen

manish_goyal skrev  den 19-11-2008 12:11:

Hi,

I am sending message to JMS queue using java application. From there i am
using log4j.properties file for logging message to File and Database. I have
added ojdbc.jar and JDBCAppender.jar file in dependency.
I am able to log in to file, but for DataBase i am getting following error:-

log4j:ERROR Failed to load driver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
  
Is the Oracle JDBC driver available in the classpath for the class 
trying to log using JDBCAppender?


--
 Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"


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



Re: Problems with rollover of RollingFileAppender - data loss

2008-11-17 Thread Thorbjørn Ravn Andersen

[EMAIL PROTECTED] skrev  den 16-11-2008 23:47:
The problem that I have encountered is that I have observed that sometimes the log files are getting partially wiped.  I am putting this down to the fact that the JVM might be shutting down whilst the rolling activity is taking place - resulting in partially rolled files.  I have tried adding a shutdown 
The rolling happens by renaming current files, not by copying contents 
from one file to another.  (See RollingFileAppender.rollOver() for code).


To me this sounds like that the log file is not properly closed when the 
application shuts down.


An idea might be running the application with the "log.debug" property 
set, so you can see what is actually happening (this means you need to 
save the console output somewhere)?  The suggested approach with doing 
socket appends might also be quite usable for you.


/Thorbjørn



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



Re: Problem in using SMTPAppender with gmail

2008-10-03 Thread Thorbjørn Ravn Andersen

RMMM skrev  den 28-09-2008 05:46:
I succeeded in getting this to work (using log4j to send logging messages by 
smtp over ssl).


I think it's appalling that log4j doesn't do this, and it isn't mentioned
anywhere in the
documentation. I even bought the complete manual for $20, but it doesn't say
a
word about this obvious issue. So, here's how I got it working. (This one's
  
I believe that the Log4j manual predates the version of JavaMail that 
could speak ssl, and I am certain that it predates the GMail service.


Unfortunately printed documentation doesn't update automatically.

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



Re: HOw to replace the system.out.println

2008-09-02 Thread Thorbjørn Ravn Andersen

Curt Arnold skrev  den 02-09-2008 19:01:


The suggestion introduces SLF4J into the mix with explanation and 
goes  through a lot of effort to evaluate the class of the calling 
statement for categorization when the cost might be excessive.  It 
would seem that if you replaced the System.println(...) with a call to 
something like:

There are many ways to skin a cat.

Your suggestion is simple but throws away all location information.  My 
suggestion is more complex (admitted, the slf4j was a spinal reflex in 
the material I dug up for this) and slow, but keeps location information


The stack trace investigation is necessary when doing a simple 
text-replace as you do not know if you are inside a static method. 

Perhaps a long term effort in this regard, could be developing an 
Eclipse/Netbeans/Whatever refactoring template which converts 
System.out/System.err references to log statements?


--
 Thorbjørn Ravn Andersen  "... plus... Tubular Bells!"


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



Re: HOw to replace the system.out.println

2008-09-02 Thread Thorbjørn Ravn Andersen

MY POI skrev  den 02-09-2008 14:34:

Thanks a lot..but here we are having hundreads of classes..

in this case any solution is there
  

This might help you getting started:

helpers/FooBar.java
=
package helpers;

public class FooBar {
   public static void main(String[] args) {
   System.out.println("Hello World");
   System.out.println("Hello World");
   org.slf4j.LoggerFactory.getLogger(Me.callerClass()).info("Hello 
World");
   org.slf4j.LoggerFactory.getLogger(Me.callerClass()).info("Hello 
World");

   }
}
=

helpers/Me.java

package helpers;

public class Me {

   public static String callerClass() {
   StackTraceElement[] stackTrace = 
Thread.currentThread().getStackTrace();

   int level = 0;
   while 
(stackTrace[level].getClassName().equals(Me.class.getCanonicalName()) == 
false) {

   level = level + 1;
   }
   // level is now *HERE*
   StackTraceElement element = stackTrace[level + 1];
   return element.getClassName();
   }
}


When FooBar is run, it generates this output:

===
Hello World
Hello World
0 INFO  helpers.FooBar Hello World
0 INFO  helpers.FooBar Hello World
===

Hence you should be able to globally replace instances of 
"System.out.println" / System.err.println with
"org.slf4j.LoggerFactory.getLogger(helpers.Me.callerClass()).info" in 
your text files and have something working. 

This requires Java 5 and is slower than actually creating a static 
logger instance but allows you to postpone the actual nitty gritty stuff 
for later.


--
 Thorbjørn Ravn Andersen  "... plus... Tubular Bells!"


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



Re: missing debug statements when i changed to RollingFileAppender

2008-08-21 Thread Thorbjørn Ravn Andersen

YesKay skrev  den 21-08-2008 16:24:

Never mind... found the problem.

  
For the benefit of those who search the archives in the future, what was 
the problem and the solution?


--
 Thorbjørn Ravn Andersen  "... plus... Tubular Bells!"


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



Re: How is the log4j.xml file located when running a program using Log4J - no workie

2008-08-11 Thread Thorbjørn Ravn Andersen

CheapLisa skrev  den 11-08-2008 21:55:


I am not running inside maven (just yet but that is the next step).  
Right
now I want to run
inside my IDE.
  

The log4j.xml file needs to be in your classpath to be found.  Is it?

--
 Thorbjørn Ravn Andersen  "... plus... Tubular Bells!"


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



Re: Need to create a thread dump in OAS

2008-08-06 Thread Thorbjørn Ravn Andersen

Amgad Mohamed skrev  den 06-08-2008 16:08:

Hi,

Does anybody know how to get a thread dump for the JVM. I'm
developing my application under oracle application server and java 1.4 and I
need a thread dump to trace logging problem.
  
That is a JVM facility.  For Unixbased systems this is often done by 
sending a signal to the JVM using the "kill" command.


--
 Thorbjørn Ravn Andersen  "... plus... Tubular Bells!"


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



Re: Logging messages using java 1.5 format string

2008-08-04 Thread Thorbjørn Ravn Andersen

Ashish Kulkarni skrev  den 04-08-2008 21:45:

Hi
Is there anyway to format the log messages using java 1.5 format
capabilities
for example i can have a nice formatted out put using
System.out.format("Number of Users on Registry %1$s, is %2$d",
registry.getName(), userSet.size());
  

Use slf4j as the logging interface and use log4j as the backend.

You can then call

log.debug("Name: {} Size {}", "Foo", new Integer(10));


--
 Thorbjørn Ravn Andersen  "... plus... Tubular Bells!"


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



Re: ConsoleAppender and closing an SSH session

2008-08-01 Thread Thorbjørn Ravn Andersen

Jeff skrev  den 01-08-2008 06:41:

Well I'm not convinced that this is completely unrelated to log4j.
This set of apps has run for 8 years in one form or another and has
been scripted to survive a logout. Now, with no changes except the
introduction of log4j, the behavior has changed.
  
I agree with Paul that I don't think this is a log4j issue as such, but 
that the actions taken by log4j may trigger the shutdown (a filled 
buffer that cannot be written?  an error message with nowhere to go?)


My knee-jerk reaction is to ask if you use "nohup" when starting your 
program over ssh?  If not, could you elaborate on "has been scripted to 
survive a logout"?


--
 Thorbjørn

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



Re: Multiplicative Bonehosery

2008-07-31 Thread Thorbjørn Ravn Andersen

David Crisp skrev  den 31-07-2008 22:23:

Hi,
 I'm using a number of API's that each use Log4j somewhere internally.
I've noticed that they all seem to step on each other's logging configs.  
I know for certain that I'm not the only person to be burned by this,

so I'm wondering what you folks normally do to avoid it.  Any pointers would
be appreciated.
  

Could you elaborate on your scenario?

I understand  that you have several pieces that use log4j independently 
of one another.  Why can you not just have a global log4j.properties 
file which merge them in a single file?


If you really need several independent log4j instances in the same 
program you must load them in seperate class loaders (most likely also 
explicitly load from a configuration file NOT named 
log4j.xml/log4j.properties).  See in LogManager.java how the loading is 
done.


--
 Thorbjørn

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



Re: Using independent logs at runtime

2008-07-28 Thread Thorbjørn Ravn Andersen

JethroXT skrev  den 28-07-2008 16:31:


Surprisingly this resulted in the desired behaviour. I don't quite know why,
because there simply aren't any loggers with that names, but I anyhow I get
independent loggers, add appenders to them by every node and get single
files with only node-relevant data. Still there is a bad taste about it,
because I don't know why it works and if it will keep working if I add new
loggers..

Any ideas?

  

Glad it helped.

I am not certain I understand your description correctly.  Could you 
provide a working example of the behaviour you describe?


--
 Thorbjørn

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



Re: Using independent logs at runtime

2008-07-27 Thread Thorbjørn Ravn Andersen

JethroXT skrev  den 27-07-2008 19:16:

Hi,
I have a problem that maybe someone could solve:

I have a network consisting of several nodes that all have to log data
independently.
I don't know the exact number of nodes before runtime, so Loggers (or
appenders) have
to be created at runtime.

  

Is this at program start time or dynamically changing while running?

If it is at program start time you can set a system property which can 
then be expanded in the log4j.properties file.  From 
PropertyConfigurator javadoc


"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|. "


Is this what you need?

--
 Thorbjørn


Re: file appender is not reporting exceptions

2008-07-26 Thread Thorbjørn Ravn Andersen

Meyer, Dave skrev  den 26-07-2008 00:23:


Any help would be greatly appreciated.  My program is logging to a 
file and any exceptions thrown are disappearing.  I am running on 
Linux.  The only way I can see the exception is to run the application 
from the command line.  It's like the log4j is not intercepting the 
stderr messages.  It is only capturing stdout messages.  How do I fix 
this?


 

From your description it sounds to me as  you are using the "program > 
file" mechanism to capture messages.   If so, you can use the sh 
mechanism to redirect standard error also with "program > file | 2>&1".  
See http://www.dsj.net/compedge/shellbasics1.html for more information.


To deal with your program exceptions I suggest you have a 
try-catch(Throwable) in your main-method.  You can then log them properly.


--
 Thorbjørn
|

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



Re: Logger Issues on Hotdeploy

2008-07-24 Thread Thorbjørn Ravn Andersen

Fu-Tung Cheng skrev  den 23-07-2008 21:12:

This happens on hotdeploy only.  Tomcat 6.0.16, jdk 1.6.0.   The logging call 
is just in a normal method that looks like:

  

The stack trace you provided does not correspond to the source of 1.2.15.

Could you please produce a stack trace when using log4j 1.2.15?

My suspicion is that it happens in this snippet, when the s.peek() call 
returns null.


 String get() {
   Stack s = getCurrentStack();
   if(s != null && !s.isEmpty())
 return ((DiagnosticContext) s.peek()).fullMessage;
   else
 return null;
 }


--
 Thorbjørn


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



Re: ALWAYS: Error encountered on logger init:[java.lang.NullPointerException]

2008-07-24 Thread Thorbjørn Ravn Andersen

rektide skrev  den 18-07-2008 18:42:

I dont know how to get any useful information about this failure, and I
cannot discern that I am doing anything wrong.  How can I get information
from log4j about its failure, and how can I debug this issue with log4j?

  
The configuration you listed works here in a simple test scenario with 
log4j-1.2.15, so it must be something else.


What version of log4j are you using?

Have you tried setting a break point in the static initializer part in 
org.apache.log4j.LogManager and step through the code?  You may want to 
set the debugger to look for NullPointerExceptions so you can catch it 
immediately. 


--
 Thorbjørn




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



Re: DailyRollingAppender doing strange things with log4j-1.2.14

2008-07-24 Thread Thorbjørn Ravn Andersen

Robert Nicholson skrev  den 17-07-2008 14:44:

No, it's like a file descriptor wasn't closed or something because
all of the 15th's log has been overwritten. ie. that 15'th log starts
at midnight 16th.

On Jul 16, 2008, at 3:07 PM, Thorbjørn Ravn Andersen wrote:


Robert Nicholson skrev  den 16-07-2008 21:03:

I'm noticying right now the following situation


-rw-r--r--  1  311170 Jul 16 14:00 name.log

-rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15

Have you found an explanation for this?  I find it a bit curious that 
there are two "name.log" files being written to on the 16th.


--
 Thorbjørn



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



Re: Suppress specific Exception

2008-07-21 Thread Thorbjørn Ravn Andersen

Sergio skrev  den 21-07-2008 22:57:

Hi,

I have the annoying uncatchable ObjectNotFoundException from hibernate 
on my log with big stack traces. I want to completely suppress this 
exception from my log. I tried to find something about filters on 
Log4J, but I think that is not the correct way to do it. Any ideas on 
how I can suppress an exception from being add to the log?
Subclass the appender in question and do your filtering before calling 
super(...)


--
 Thorbjørn

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



Re: DailyRollingAppender doing strange things with log4j-1.2.14

2008-07-16 Thread Thorbjørn Ravn Andersen

Robert Nicholson skrev  den 16-07-2008 21:03:

I'm noticying right now the following situation


-rw-r--r--  1  311170 Jul 16 14:00 name.log

-rw-r--r--  1  455880 Jul 16 14:00 name.log.2008-07-15

 What you should see is that today's log is actively overwriting yesterday's
rolled log.

So yesterdays log is history as it's been overwritten.

Can anybody explain this behaviour and whether a newer version corrects this
problem?
  
The rolling does not happen automatically at midnight, but when a 
logging event has been determined to be in the "next" period.


Are the contents of the logs correct?

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



Re: JDBCAppender configuration

2008-07-15 Thread Thorbjørn Ravn Andersen

Johannes Hoechstaedter skrev  den 15-07-2008 16:20:

Hi everybody,

I am up to build a coocon webapplication, and I am using the 
JDBCAppender for logging. It works quite well. My only problem is, 
that when I switch on the loggin in debug mode, my application is as 
fast as a snail because of the heavy database traffic. How can I solve 
that? I need the debug mode, because on other modes like info or 
Without having used it, I would suspect that you have autocommit on (the 
default) on your JDBC-connection.


--
 Thorbjørn

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



Re: DailyRollingFileAppender

2008-07-08 Thread Thorbjørn Ravn Andersen

[EMAIL PROTECTED] skrev  den 08-07-2008 12:02:

Hi,
I am using DailyRollingFile Appender for manage my log.
but i want to backup just the last 5 days?
is that possible to do that?
The DailyRollingFileAppender does not keep track of versions back in 
time, so it cannot do what you want.  I would suggest running a cleaning 
job once in a while, either from within your java application or 
schedule an operating system task.


--
 Thorbjørn

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



Re: Replace a file in DailyRollingFileAppender

2008-07-08 Thread Thorbjørn Ravn Andersen

Aggarwal, Rajat skrev  den 08-07-2008 11:12:

Hi Thorbjørn

Actually, I have a created a logger instance and am adding an appender to it 
through my java code. So, I am not sure if I still need to make configuration 
entries in log4j.properties file. If you want, I can also send across the piece 
of code I have written for thee same.
  
You can reconfigure a logger strictly from an in-memory set of 
properties without a log4j.property file as such.


I think you should show a minimal case of what you have done, and what 
you would like to do.


--
 Thorbjørn

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



Re: Replace a file in DailyRollingFileAppender

2008-07-08 Thread Thorbjørn Ravn Andersen

Aggarwal, Rajat skrev  den 08-07-2008 07:44:

Hi All,

 


Is there any way we can replace a file attached to a particular appender
using java code? I am using DailyRollingFileAppender for my purpose and
want to log to separate files depending upon certain configurations made
in the database. Can we dynamically change the files an appender is
writing to? If so, how?
Have you tried creating a new configuration for that particular appender 
and programatically telling log4j to load that configuration?


--
 Thorbjørn

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



Re: precision of log4j

2008-07-08 Thread Thorbjørn Ravn Andersen

sana qadir skrev  den 08-07-2008 05:18:

Despite synchronizing the time on the two machines using NTP, I am getting not 
only poor resolution but also negative propagation values which are ridiculous. 
Any idea about how I can get better resolution is this scenario

Sounds like you have to do a roundtrip.  A->B->A.

Otherwise you must synchronize both computers to exactly the same time, 
i.e. an external atomic clock.


--
 Thorbjørn

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



Re: "additivity" attribute does not work for user-defined logger but works for root logger.

2008-07-06 Thread Thorbjørn Ravn Andersen

Jacob Kjome skrev  den 07-07-2008 08:11:


logging name each time it is used.  You'll have do add a constructor that takes 
a
logger name, such as...

public SQLStatements(String loggerName) {...}

And then each time you use this helper class, pass in the logger name to use.  
For
instance...

  


Another option is just passing in another Logger object in the call to 
the method.


That may confuse a maintainer though.  I spent some time a while ago 
locating a logger which had been initialized with the wrong class so the 
messages came from a different class.


--
 Thorbjørn

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



Re: "additivity" attribute does not work for user-defined logger but works for root logger.

2008-07-03 Thread Thorbjørn Ravn Andersen

Camer38 skrev  den 03-07-2008 15:25:

My assumption was that if I run one of the class
curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter I would got all
the logs from that class and all the classes used internally by
curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in the
addQuestionSequenceOrderTool.log.
  
No.  The logger frameworks do not do magic to deduce where logging 
should go.  If you want for classes called to use a specific logger, you 
must pass it as an argument like all values you want to use.



 Instead I got an log4j warning: 


log4j:WARN No appenders could be found for logger
(curam.tools.upgradehelper.util.SQLStatements). 

  
You are most likely using a logger variable in SQLStatements which has 
been defined at the top of that class referring to SQLStatments.class.


This does not allow log4j to distinguish between the two cases you have.

I have the same problem in a project where it is two threads logging in 
the same file.  I have not yet found a good solution.

During my testing I have defined a root logger as well,  but it does not do
what I want. 
  
All the expected lines are present in both files but the files are populated

with the log from the same class.






  


This say that you want all messages at info level or higher to go to 
both the taskRedirection appender AND the addQuestionSequenceOrder appender.


--
 Thorbjørn

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



Re: additivity attribute for logger does not diffrently for root and user-defined logger.

2008-07-03 Thread Thorbjørn Ravn Andersen

Camer38 skrev  den 03-07-2008 15:15:

Instead I got an log4j warning:
log4j:WARN No appenders could be found for logger
(curam.tools.upgradehelper.util.SQLStatements).

  
This sounds like your configuration file is not picked up.  Try running 
with -Dlog4j.debug=true to see what is happening.



What is the  meaning of the attribute "additivity" for each logger?
  

From http://logging.apache.org/log4j/1.2/manual.html

"*Appender Additivity*

   The output of a log statement of logger /C/ will go to all the
   appenders in /C/ and its ancestors. This is the meaning of the term
   "appender additivity".

   However, if an ancestor of logger /C/, say /P/, has the additivity
   flag set to |false|, then /C/'s output will be directed to all the
   appenders in /C/ and it's ancestors upto and including /P/ but not
   the appenders in any of the ancestors of /P/.

   Loggers have their additivity flag set to |true| by default.

"

There is a table detailling the rules on the page.

--
 Thorbjørn

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



Is there a way to make Eclipse recognize log4j messages in its console buffer and hyperlink to the statement that created it?

2004-01-02 Thread Thorbjørn Ravn Andersen
We use Eclipse for development and I like the way that stacktraces are 
shown and linked to the underlying source, so I was pondering whether 
similar functionality is possible for the numerous debug messages we 
have?  I looked at the Ganymede plugin, but it requires an alternate 
log4j configuration, which I would prefer not to have.

Is there other approaches for this?  Or should I look into conditional 
configuration files?

--
 Thorbjoern Ravn Andersen  "...plus...Tubular Bells!"


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