Broken link in log4j API docs

2010-03-16 Thread Matt Brown
Not sure if this is the proper list to report this on but
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/DOMConfigurator.htmllinks
to
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/log4j.dtdwhich
is broken.

Thanks
Matt


Re: one project multiple log files

2009-11-20 Thread Matt Brown
What does your log4j.xml/properties look like?

What you want is easily achievable, you just need to set it up correctly.

log4j.rootLogger = ERROR

log4j.logger.com.one = DEBUG, ONE
log4j.logger.com.two = DEBUG, two

log4j.appender.ONE = ...
log4j.appender.TWO = ...

etc.

On Fri, Nov 20, 2009 at 2:49 AM, d1ve blu3 d1ve2b...@gmail.com wrote:

 hi,,

 i'm new to this group.

 I've manage to generate 2 log files. but it seems both content are same,,

 what i want to know is it possible to generate two log files with
 different content?
 example:
 I had a java project. it have 2 packager. com.one and com.two.
 What i want now is to log every class in com.one to one.log and log
 every class in com.two to two.log.

 is it possible???

 thanks before,,,

 --
 This transmission may contain confidential or privileged material. Any use
 of
 this information by anyone other than the intended recipient is prohibited.
 If
 you have received this transmission in error, please immediately throw
 away your computer because this message will explode in 10 second.

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




Re: bizarre NPE exception

2009-11-20 Thread Matt Brown
FAQ answer refers to log4j 1.2.16, which has not been released yet - is that
coming soon?

On Fri, Nov 20, 2009 at 8:26 AM, Curt Arnold carn...@apache.org wrote:

 Please read the FAQ on Tomcat class-loading at
 http://svn.apache.org/repos/asf/logging/log4j/trunk/src/site/fml/faq.fml.
  There are ways to reconfigure Tomcat (and most likely Glassfish) that will
 avoid the issue if you can't update to a release that has the bug fixed.
 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org




RE: Log4j over several java classes

2009-11-04 Thread Matt Brown
If each of your classes create a new LogFile instance, and the constructor of 
the LogFile class creates a new appender and adds it to the root logger, then 
this means that you've attached N copies of the appender to the root logger. 
This explains why you are seeing the message duplicated in the file, since each 
appender is writing to the same file.

Is there any reason why you don't have each class get a Logger instance with 
the same name of the class? This is the standard usage pattern and is very 
simple and works well: http://logging.apache.org/log4j/1.2/faq.html#2.4

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



-Original Message-
From: DanyLux [mailto:dany.gilgo...@gmail.com] 
Sent: Wednesday, November 04, 2009 7:22 AM
To: log4j-user@logging.apache.org
Subject: Log4j over several java classes


Hello to all users,

I am new on Log4j.
I am doing a project in java with eclipse and my project has the following
structure:

package
   underpackage
  categories
one
class1.java
class2.java
two
class3.java
class4.java   -- Applet
class5.java
three
LogFile.java

And some other information:
class4 calls class3 and class5
class2 is called by class1 and class1 called by class5.

In LogFile i have written the following:
public class LogFile {

private static final String dirname  = ./log/; //location of the log 
files
private static  Logger logger   = Logger.getRootLogger();

/**
 * This is the default constructor
 */
public LogFile() {
try {
PatternLayout layout = new PatternLayout( %d (%c) [%t] 
%-5p %m%n );
DailyRollingFileAppender fileAppender =
new DailyRollingFileAppender( layout, dirname + 
Log.log, '.'-MM-dd );
logger.addAppender( fileAppender );
logger.setLevel(Level.INFO);
} catch( Exception ex ) {
System.err.println( ex );
}
}

public void logError(String message){
logger.info(+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+);
logger.info(Write several more information);
logger.error(message);
}
}


And so I called it on the several classes:
private static LogFile lfLogging = new LogFile(); .
lfLogging.logError(Error Message is written here!);


Well I entered it to all the class and the Logfile is written, the only problem 
is when the method is called to write to logfile then it is not just written 
once, but it is written 4 times the same. I commented in all class just not in 
one the lines of logfile calling and then it just write once in the LogFile.


Can somebody help me how I have to declare that my LogFile works correctly.

Many thanks in advance for your help.

Best regards,
Dany






--
View this message in context: 
http://old.nabble.com/Log4j-over-several-java-classes-tp26195319p26195319.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Logging without logging to the root logger

2009-10-21 Thread Matt Brown
Why don't you just move the appender-ref for stdoutAppender from the root level 
to the my.company logger?



-Original Message-
From: Ofer Kalisky [mailto:kali...@hotmail.com] 
Sent: Wednesday, October 21, 2009 2:15 PM
To: log4j-user@logging.apache.org
Subject: Logging without logging to the root logger


Hi,

I have the following config:

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

appender name=reportFileAppender
class=org.apache.log4j.RollingFileAppender


!-- Keep one backup file --

layout class=org.apache.log4j.PatternLayout

/layout
/appender 

appender name=stdoutAppender 
class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout

/layout
/appender 

logger name=db_report
level value=info /
appender-ref ref=reportFileAppender/
/logger

logger name=com.mycompany
level value=info /
/logger

root
priority value=warn/
appender-ref ref=stdoutAppender/
/root

/log4j:configuration

In the source I do:
private static Logger reportLogger = Logger.getLogger(db_report);

and in other classes I do:
private static Logger anyClassLogger =
Logger.getLogger(com.mycompany.MyClass.class);

I would like things logged to the db_report not to be logged in the 
stdoutAppender, but I can't get them out of there, since the root logger has it 
and it seems it catches all...

how can I log things to the report.log file without it being outputted to the 
stdout as well?

thanks



--
View this message in context: 
http://www.nabble.com/Logging-without-logging-to-the-root-logger-tp25997550p25997550.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: log4j xml format to log4j.properties help

2009-10-13 Thread Matt Brown
Looking at the source, it appears that PropertyConfigurator supports both 
log4j.category or log4j.logger interchangably, as well as 
log4j.rootCategory and log4j.rootLogger.

Do you really mean for this to be all on one line or is it an email formatting 
error?

log4j.category.com.opensymphony.xwork2.ognl.OgnlValueStack=off, xwork 
log4j.appender.xwork=org.apache.log4j.ConsoleAppender


I would try:

log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = ERROR

And to be safe, you can kill all opensymphony logging as well:

Log4j.logger.com.opensymphony.xwork2 = ERROR


-Original Message-
From: strutstwouser [mailto:strutstwou...@gmail.com] 
Sent: Tuesday, October 13, 2009 9:44 AM
To: log4j-user@logging.apache.org
Subject: log4j xml format to log4j.properties help


Hi,
I'm trying to suppress verbose logs from a Struts2 application. The Wiki
(http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Reduceverboselogging)
says to add : 

category name=com.opensymphony.xwork2.ognl.OgnlValueStack
  priority value=error/
   /category

to log4j.xml

However, our system uses log4j.properties files, so i tried to do the same as : 

log4j.rootCategory=off

log4j.category.com.opensymphony.xwork2.ognl.OgnlValueStack=off, xwork 
log4j.appender.xwork=org.apache.log4j.ConsoleAppender
log4j.appender.xwork.layout=com.abc.logging.impl.Log4JPatternLayout
log4j.appender.xwork.layout.ConversionPattern=%d{-MM-dd'T'HH:mm:ss.SSSZ}
%-5p %c{1} - %m%n

This does not show any change in behavior and the logs still appear.

I see some examples that start with log4j.rootLogger= instead of 
log4j.rootCategory= . Does that matter ? . Am i missing something ? 

Thanks,
s2user


--
View this message in context: 
http://www.nabble.com/log4j-xml-format-to-log4j.properties-help-tp25873162p25873162.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Diff between Logger and Log

2009-09-30 Thread Matt Brown
Log and LogFactory are not log4j classes 
(http://logging.apache.org/log4j/1.2/apidocs/index.html).

However they are both Commons Logging classes ( 
http://commons.apache.org/logging/commons-logging-1.1.1/apidocs/index.html ).

Are you using Commons Logging on accident?

Or are you trying to find out the differences between Commons Logging and 
Log4j? Take a look at 
http://commons.apache.org/logging/commons-logging-1.1.1/guide.html.



-Original Message-
From: SkyMe [mailto:gs_v...@mail.ru] 
Sent: Wednesday, September 30, 2009 8:03 AM
To: log4j-user@logging.apache.org
Subject: Diff between Logger and Log


Hello! I faced with a such situation when Logger and Log act differently.
I configure my log4j with

DOMConfigurator.configureAndWatch(xmlFileName);

In the configure xml file there is defined only one appender - FileAppender.
So, when I'm using

Log log = LogFactory.getLog(name);

and then

log.info(I'm a log!);

it writes this log to file.

But when I'm using

Logger logger.getLogger()
or
LogManager.getLogger()

they write logs only to the console! Why don't they use configurations from xml 
file?

context: I deploy my app to JBoss AS, I use my owm log4j.xml (not JBoss'
one), I added log4j.jar to the lib of my .ear project.

Thank you!
--
View this message in context: 
http://www.nabble.com/Diff-between-Logger-and-Log-tp25679656p25679656.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Log session session information (Web)

2009-09-30 Thread Matt Brown
I've implemented this before by writing a javax.servlet.Filter to add the 
SessionID to the MDC of every request. 

-Original Message-
From: Renan Vinícius Mozone [mailto:renan.moz...@gmail.com] 
Sent: Wednesday, September 30, 2009 2:13 PM
To: log4j-user@logging.apache.org
Subject: Log session session information (Web)

I'm planning to use log4j on a JSP based application. However, every log 
entry must have a session identification. This session identification is in a 
session variable.
How can I configure the formatter to achieve this?

The log entry must be something like this:

[TIMESTAMP] [THREAD] [LOG LEVEL] [SESSION ID] [MESSAGE]

Thanks in advance.

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



RE: Logging done in the wrong files

2009-09-12 Thread Matt Brown
Your mentions of EAR files make me wonder if the different applications are 
running in the same classloader - are they?

Have you put log4j in a common classloader shared by both applications?  This 
might explain what you are seeing - IIRC web containers like WebSphere set up 
hierarchal classloaders for EAR applications, and a class which is loaded from 
the shared classloader will be shared by all child classloaders - in other 
words, the same log4j configuration will be used by all child classloaders 
(because there is actually only one instance of the configured log4j classes).

It might be better to configure the specific loggers for each app, such as
log4j.logger.com.yourcompany.web = ...
log4j.logger.com.yourcompany.java = ...

Also, not sure if you realize this but by passing in the log level to your 
logMessage(String strLevel, String Message) wrapper function, you lose any 
possible benefits of guard clauses and overly long messages not having to be 
concatenated by the JVM (http://logging.apache.org/log4j/1.2/faq.html#2.3).


From: S.Kannan [techy_k...@yahoo.co.in]
Sent: Friday, September 11, 2009 11:40 PM
To: log4j-user@logging.apache.org
Subject: Logging done in the wrong files

Hi All, A log4j newbie handling a bigger task .. This is my problem
Hope somebody has got some solution for this.

We have a web application as well as a java application. Both are big enough
. But since both are managing the same business around 3 to 4 ear files are
used in common for both the applications. Since we wanted to classify the
loggers based on the application we have decided to have unique
log.properties file. The following are the configurations in the
log.properties file

for web application
log4j.threshold=ALL
log4j.rootLogger=ALL,INFO_APPENDER,ERROR_APPENDER,DEBUG_APPENDER
log4j.appender.DEBUG_APPENDER=org.apache.log4j.RollingFileAppender
log4j.appender.DEBUG_APPENDER.MaxBackupIndex=50
log4j.appender.DEBUG_APPENDER.MaxFileSize=10MB
log4j.appender.DEBUG_APPENDER.file=data/tda/logs/Logger_Debug_Web.txt
log4j.appender.DEBUG_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.DEBUG_APPENDER.Threshold=DEBUG

for java application
log4j.threshold=ALL
log4j.rootLogger=ALL,INFO_APPENDER,ERROR_APPENDER,DEBUG_APPENDER
log4j.appender.DEBUG_APPENDER=org.apache.log4j.RollingFileAppender
log4j.appender.DEBUG_APPENDER.MaxBackupIndex=50
log4j.appender.DEBUG_APPENDER.MaxFileSize=10MB
log4j.appender.DEBUG_APPENDER.file=data/tda/logs/Logger_Debug_Java.txt
log4j.appender.DEBUG_APPENDER.layout=org.apache.log4j.PatternLayout
log4j.appender.DEBUG_APPENDER.Threshold=DEBUG

The following is the customized log manager class which we have written
public class LogManager {
String className;
Logger objLog;

static {
InputStream logprops = LogManager.class.getClassLoader()

.getResourceAsStream(path/to/log.properties);
try {
Properties prop = new Properties();
prop.load(logProps);
PropertyConfigurator.configure(prop);
} catch (Exception e) {
System.out.println(error in  LogManager +
e.getMessage());
}
}

public LogManager(String className) {
this.className = className;
objLog = Logger.getLogger(this.className);
}

public void logMessage(String strLevel, String Message) {
if (strLevel.equals(DEBUG)) {
objLog.log(Level.DEBUG, Message);
} else if (strLevel.equals(INFO)) {
objLog.log(Level.INFO, Message);
} else if (strLevel.equals(WARN)) {
objLog.log(Level.WARN, Message);
} else if (strLevel.equals(ERROR)) {
objLog.log(Level.ERROR, Message);
}
}
}

And in each class files we have called the logmanager like

private static final LogManager logMgr = new
LogManager(QueueListener.class.getName());
logMgr.logMessage(INFO,QueueListening starts.);

Now our problem is that most of the times the messages in the
Logger_Debug_Java.txt is routed to Logger_Debug_Web.txt once a class which
is common for both application executes. Then the thread or control does not
go back to the Logger_Debug_Java.txt file. Please give me a solution for
this problem

Kannan.S
--
View this message in context: 
http://www.nabble.com/Logging-done-in-the-wrong-files-tp25411329p25411329.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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

RE: Verifying initialization

2009-09-11 Thread Matt Brown
I don't think you're going to find anything in log4j proper which can help you 
find out this type of information.

I believe that one of the major design goals for log4j was for the framework to 
fail gracefully, and not have logging errors cause application errors - not to 
prevent an application from running just because the log file couldn't be 
found/opened/etc. 

-Original Message-
From: ecmcn [mailto:eric.mcne...@gmail.com] 
Sent: Thursday, September 10, 2009 7:48 PM
To: log4j-user@logging.apache.org
Subject: Verifying initialization


What are some common techniques for verifying Log4J startup and initialization 
completed successfully? 

For a specific example, if DOMConfigurator can't parse my XML config file I'll 
get errors to stdout but nothing that tells my code there was a problem. I 
tried checking for the existence of my Appenders, but it seems they're loaded 
asynchronously. I could loop and wait until they're all there, but it seems 
like I must be missing something obvious. 

Any best practices out there?

thanks,
Eric
--
View this message in context: 
http://www.nabble.com/Verifying-initialization-tp25392804p25392804.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Uregent Issue in log4j log message is rooted to System.out

2009-09-04 Thread Matt Brown
Take a look at the axis.jar (and other axis-related jars, such as axis-ant.jar) 
and make sure to remove any log4j.properties / log4j.xml that any of them might 
have packaged within the JAR.

I remember being bitten by a similar problem once before - one of the axis JARs 
unexpectedly including a log4j configuration, which was overriding my own. 

-Original Message-
From: news [mailto:n...@ger.gmane.org] On Behalf Of Rajesh.J
Sent: Friday, September 04, 2009 12:33 AM
To: log4j-user@logging.apache.org
Subject: Uregent Issue in log4j log message is rooted to System.out

I am using log4j to log my messages The problem I am getting is in some cases 
the log message is routed to System.out . And my message are printed in 
system.out with a prefix of standalonelogger. This problem is occurring where 
webservices related jars are used(axis.jar). I have even set my loggers 
addivity to false.Still I could not find any solution for this. I have even 
removed the cosole appender  of the Root category of axis.jar ,Still there is 
no improvement.My code is perfectly working in other environments where 
webservices related jars are not used.Why there is a prefix StandaloneLogger 
is coming. Even if my logger is inherting console appender from its parent
(somehow) where
from the message  StandaloneLogger is coming.

If my code had the line as below
Log.debug(some message to be logged);

Output in System out is

 [9/3/09 14:23:12:961 EST] 0072 SystemOut O 2009-09-03 14:23:12,953
StandaloneLogger DEBUG - some message to be logged


Please help me on this issue.



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


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



RE: Windows server 2 008 64 bit

2009-09-01 Thread Matt Brown
Does Java run on Windows 2008? Then log4j will work on it. 

-Original Message-
From: than...@ovi.com [mailto:than...@ovi.com] 
Sent: Tuesday, September 01, 2009 1:05 AM
To: log4j-user@logging.apache.org
Subject: Windows server 2 008 64 bit 

Dear All,
I would like to know whether log4j 1.2.15 works/supported on a windows server 
2008 OS.  any official site link to know the same. 

Thanks,
Thanik


-
Ovi Mail: Create an account directly from your phone http://mail.ovi.com


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


-
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 Matt Brown
I believe with JDK5 you can use jconsole, which is very similar to VisualVM and 
has most of the same sort of features. Perhaps that will help in the future.


From: Arica [xun...@263.net]
Sent: Wednesday, June 24, 2009 10:39 PM
To: log4j-user@logging.apache.org
Subject: Re: High CPU usage impact to log4j

Hi, Andersen

Thanks for your suggestions.

The Visual VM is quite powerful tool, but introduced from JDK6. My issue was
happened at JDK5:(
Besides, before add some algorithm to dump the JVM snapshot, I need to
understand what's the root cause to result in the abnormal behavior of
log4j. The most frustrating thing is that I cannot reproduce the issue with
100% (log4j and kill -3 signal cannot be handled by JVM) :(

Anyway, thank you again.



Thorbjørn Ravn Andersen wrote:

 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




--
View this message in context: 
http://www.nabble.com/High-CPU-usage-impact-to-log4j-tp24179322p24196085.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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



RE: Logging to console and file at different levels

2009-06-05 Thread Matt Brown
You can try adding a threshold to the console appender:

log4j.appender.CONSOLE.threshold = WARN

This should tell the console appender to ignore any log messages it might 
receive below the WARN level.

 

-Original Message-
From: Bai Shen [mailto:baishen.li...@gmail.com] 
Sent: Friday, June 05, 2009 2:09 PM
To: log4j-user@logging.apache.org
Subject: Logging to console and file at different levels

I have a web service using Axis and running on Tomcat.  I'm using slf4j piping 
to log4j.  I have the root logger set to WARN and to output to a file and the 
console.  I also have a logger setup for just my application set to INFO 
logging to the file.  I had to turn off addivity in order to get it to not log 
to the console.

What I'd like to do is have my application still log any WARN messages in the 
console as well as the file.  But I don't want any of the INFO messages in the 
console.  How do I configure my setup to do that?

TIA.

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



RE: DailyRollingAppender - How does it know when to rollover?

2009-05-19 Thread Matt Brown
What is LOGO:?

And are you sure the user the application runs under has sufficient access to 
create/rename files in whichever directory it is attempting to write to? 

-Original Message-
From: Marc Farrow [mailto:marc.far...@gmail.com] 
Sent: Tuesday, May 19, 2009 8:09 AM
To: log4j-user@logging.apache.org
Subject: RE: DailyRollingAppender - How does it know when to rollover?


I finally got around to this again.  I changed the rollover time to be in 
seconds so I should get a new log with each execution.  When I run the app, I 
get a new log, but the rolled over file is not created.  I cannot find a file 
with my matching DatePattern.  Below is my Properties file.

log4j.rootLogger=WARN, R
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=LOG0:MyLogFile.log
log4j.appender.R.DatePattern='.'-MM-dd-mm-ss
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %d{-MMM-dd HH:mm:ss.SSS} - 
%m%n log4j.appender.R.ImmediateFlush=true
log4j.logger.com.company.myfile=INFO


Anyone have any suggestions?



Thanks.

Marc



Marc Farrow wrote:
 
 I haven't done this because my brain is too one-dimensional today.  
 Great suggestion.
 
 Thanks.
 
 Marc
 
 
 
 Matt Brown-20 wrote:
 
 
 Just a suggestion, but if this is a development server, and the 
 application is already getting re-deployed more than daily, why not 
 experiment with a smaller rollover time (daily or hourly)? Just to 
 make sure that DailyRollingAppender isn't somehow borked in your 
 combination of OS / app server / application.
 
 -Original Message-
 From: Marc Farrow [mailto:marc.far...@gmail.com]
 Sent: Monday, May 11, 2009 8:34 AM
 To: log4j-user@logging.apache.org
 Subject: Re: DailyRollingAppender - How does it know when to rollover?
 
 
 I checked the log file for my container (Tomcat) and there were no 
 error messages that I could see for any rollover messages.  However, 
 I guess I am going to have to wait til next month to verify.  Since 
 my container is Tomcat and my container gets restarted fairly often 
 (multiple times a day because this is a our development server), 
 could this affect the rollover logic?
 
 Thank you,
 
 Marc
 
 
 
 Paul Smith-2 wrote:
 
 the first logging event _after_ the time period computed should roll 
 the file over, however if there is any failure (perhaps because 
 another process has the file handle open, a common problem on 
 Windows), the rollover can fail, and you'll need to wait to the next 
 window (another month).
 
 When the failure occurs, it does log to StdErr (from the source code 
 to DailyRollingFileAppender):
 
protected void subAppend(LoggingEvent event) {
long n = System.currentTimeMillis();
if (n = nextCheck) {
now.setTime(n);
nextCheck = rc.getNextCheckMillis(now);
try {
rollOver();
}
catch(IOException ioe) {
if (ioe instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
}
LogLog.error(rollOver() failed., ioe);
}
}
super.subAppend(event);
}
 
 It tries it's best to continue logging until next roll over period.
 
 Paul
 
 On 11/05/2009, at 9:31 PM, Marc Farrow wrote:
 

 This is a fairly simple question.  Does anyone that maintains or 
 create LOG4J read these posts anymore?

 Thanks.

 --
 View this message in context:
 http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-
 to -rollover--tp23390773p23481523.html
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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

 
 Paul Smith
 Production Engineering Manager
 
 Aconex
 The easy way to save time and money on your project
 
 696 Bourke Street, Melbourne,
 VIC 3000, Australia
 Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
 Email: psm...@aconex.com  www.aconex.com
 
 This email and any attachments are intended solely for the addressee.  
 The contents may be privileged, confidential and/or subject to 
 copyright or other applicable law. No confidentiality or privilege 
 is lost by an erroneous transmission. If you have received this 
 e-mail in error, please let us know by reply e-mail and delete or 
 destroy this mail and all copies. If you are not the intended 
 recipient of this message you must not disseminate, copy or take any 
 action in reliance on it. The sender takes no responsibility for the 
 effect of this message upon the recipient's computer system.
 
 
 
 
 
 
 
 --
 View this message in context:
 http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to
 -rollover--tp23390773p23482416.html
 Sent from the Log4j - Users mailing list archive at Nabble.com

RE: tomcat catalina logs

2009-05-11 Thread Matt Brown
http://wiki.apache.org/tomcat/HowTo#head-af688216137bbf0542fa3f599cd4c41dcba68056
 

-Original Message-
From: Kaushal Shriyan [mailto:kaushalshri...@gmail.com] 
Sent: Monday, May 11, 2009 6:40 AM
To: log4j-user@logging.apache.org
Subject: tomcat catalina logs

Hi

Is there a step by step guide to configure log4j with syslog to a centralized 
server for all the servers running tomcat catalina.out logs.

Thanks and Regards

Kaushal

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



RE: DailyRollingAppender - How does it know when to rollover?

2009-05-05 Thread Matt Brown
The date pattern that you have:

log4j.appender.R.DatePattern='.'-MM


Will only roll the files over on a monthly basis. Just want to be sure that 
this is what you intend?

If this is the intended behavior, I'd check to make sure that a different log4j 
configuration file isn't being loaded from somewhere in the OpenVMS 
environment. You can enable the -Dlog4j.debug system property to be able to see 
which config file log4j is using. 

-Original Message-
From: Marc.Farrow [mailto:marc.far...@gmail.com] 
Sent: Tuesday, May 05, 2009 12:14 PM
To: log4j-user@logging.apache.org
Subject: DailyRollingAppender - How does it know when to rollover?


I am trying to use LOG4J on OpenVMS.  However, my logger is not rolling over on 
OpenVMS.  So I want to know how the code is determining when the log file 
should be rolled over.  Below I am posting my code and properties file.  The 
same code works on windows (of course, I have different properties file that 
loads on windows).  For completeness sake, I am posting both properties files.


package com.name.webpublishing.webpublishing;
public class WebPublishingApp {
public static Logger logger = getLogger();
private static Logger getLogger() {
try {
String osName =
System.getProperty(os.name).toLowerCase().equals(openvms) ? openvms :
windows;
InputStream is =
WebPublishingApp.class.getClassLoader().getResourceAsStream(/com/name/webpublishing/webpublishing/log4j_
+ osName + .properties);
Properties props = new Properties();
props.load(is);
PropertyConfigurator.configure(props);
System.out.println(LOADED PROPERTIES!!!);
} catch (IOException ignored) {
if (SeflWebPublishingServlet.DEBUG) {
ignored.printStackTrace();
}
// just use default
}
return Logger.getLogger(WebPublishingApp.class);
}
}

openvms properties - log4j_openvms.properties log4j.rootLogger=WARN, R 
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=LOG0:WebPublishing.log
log4j.appender.R.DatePattern='.'-MM
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %d{-MMM-dd HH:mm:ss.SSS} - 
%m%n log4j.appender.R.ImmediateFlush=true
log4j.logger.com.sefl.webpublishing=DEBUG

windows properties - log4j_windows.properties log4j.rootLogger=WARN, R 
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=C:/WebStatic/webtmp/WebPublishing.log
log4j.appender.R.DatePattern='.'-MM
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %d{-MMM-dd HH:mm:ss.SSS} - 
%m%n log4j.appender.R.ImmediateFlush=true
log4j.logger.com.sefl.webpublishing=DEBUG
--
View this message in context: 
http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23390773.html
Sent from the Log4j - Users mailing list archive at Nabble.com.

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



RE: Log stack trace or simply message option?

2009-04-28 Thread Matt Brown
How are users seeing the log output - console output? A file?

If it is only the former, then you could simply have the log messages sent to 
the console AND a log file as well, in case you need the latter for 
troubleshooting.

Sorry if it sounds like I'm dodging your main question - I wouldn't know the 
answer to that so I'm just trying to offer up some other suggestions that might 
solve your problem without changing the log4j behavior. 

-Matt 

-Original Message-
From: Steven Keens [mailto:ke...@pcigeomatics.com] 
Sent: Tuesday, April 28, 2009 7:09 AM
To: Log4J Users List
Subject: RE: Log stack trace or simply message option?

Matt,

The reason for not wanting the stack trace in release mode is because some 
users don't want to see it.  As a user I can understand that.  As a developer I 
like to see the stack trace.  Adding the option helps both parties.

I thought of your solution but that doubles the log events for exceptions when 
debug is enabled.  

There is precedence for what I'm asking.  The PatternLayout lets me choose what 
is written in the log.  Why are exceptions special that they must always be 
written?

Cheers
--
Steven Keens
 

-Original Message-
From: Matt Brown [mailto:matt.br...@citrixonline.com]
Sent: Monday, 27 April, 2009 16:28
To: Log4J Users List
Subject: RE: Log stack trace or simply message option?

I'm kind of curious why you wouldn't want the stacktrace in release
mode. Isn't it just as valuable to you then as it is during debug mode
- perhaps moreso if it is a release version of your software?

You could just log the exceptions to a different level, one that is not enabled 
in the release mode, something like:

catch (SomeException e) {
   log.debug(caught SomeException, e);
   log.error(caught SomeException);
}

And then have the debug level disabled in release version.

-Original Message-
From: Steven Keens [mailto:ke...@pcigeomatics.com]
Sent: Monday, April 27, 2009 2:54 PM
To: Log4J Users List
Subject: Log stack trace or simply message option?



In some places in my code I use the Logger.error(String msg, Throwable
t) function to emit log events.  When running in release mode I'd like
to just simply show the log message.  When running in debug mode I'd
like to show the full stack trace.

Is there a way to disable logging the stack trace based upon a
configuration option? Would I have to write my own code?

I did a relatively quick scan through the source and could not find a
way to do it.

Cheers
--
Steven Keens
 
Duct tape is like the force. It has a light side, a dark side, and it
holds the universe together.  - Carl Zwanzig
 
PCI Geomatics
OGC Technical Representative
Phone: 819-770-0022 x204
Fax: 819-770-0098
Email: ske...@pcigeomatics.com
Website: www.pcigeomatics.com



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


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



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


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



RE: Log4j exception Could not close org.apache.log4j.helpers.CountingQuietWriter

2009-04-24 Thread Matt Brown
Can you share your log4j configuration? 

-Original Message-
From: ramakrishna menon [mailto:rmenon...@gmail.com] 
Sent: Friday, April 24, 2009 11:08 AM
To: log4j-user@logging.apache.org
Subject: Log4j exception Could not close 
org.apache.log4j.helpers.CountingQuietWriter

Hi I have a web application installed on a single tomcat instance.

After around 2 to 5 days of running, the entire application stalls. When 
checking the log, I get the following error stack. I did some research on this 
on google but could not find any solution. What can I do to avoid this 
situation? A tomcat bounce typically resolves the situation temporarily.

Thank you!
Menon
Apr 23, 2009 11:40:40 PM org.apache.catalina.core.StandardWrapperValve
invoke
INFO: log4j:ERROR Could not close
org.apache.log4j.helpers.countingquietwri...@11361f82
java.io.IOException: Input/output error
at java.io.FileOutputStream.close0(Native Method)
at java.io.FileOutputStream.close(FileOutputStream.java:279)
at
sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:431)
at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)
at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)
at java.io.FilterWriter.close(FilterWriter.java:92)
at org.apache.log4j.FileAppender.closeFile(FileAppender.java:183)
at
org.apache.log4j.RollingFileAppender.rollOver(RollingFileAppender.java:146)
at
org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:239)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
at
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
at org.apache.log4j.Category.callAppenders(Category.java:203)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.debug(Category.java:257)
at
com.opinmind.db.DbUtil.executeDbProcAffectingRows(DbUtil.java:244)
at
com.opinmind.webapp.exporter.AbstractExporter.logExtractorStats(AbstractExporter.java:139)
at
com.opinmind.webapp.exporter.ExporterAssumingClientOnDbImpl.generateFile(ExporterAssumingClientOnDbImpl.java:138)
at
com.opinmind.webapp.etl.extractor.DbDataExporter.getFiles(DbDataExporter.java:65)
at
com.opinmind.webapp.etl.extractor.action.ExtractDbDataIntoFileAction.doExecute(ExtractDbDataIntoFileAction.java:71)
at com.opinmind.webapp.action.BaseAction.execute(BaseAction.java:50)
at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

---
R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC 
Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/
---
---
R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC 
Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/
---

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



RE: Log4j exception Could not close org.apache.log4j.helpers.CountingQuietWriter

2009-04-24 Thread Matt Brown
I'm not really up on the internals of RollingFileAppender, but I would bet that 
the file residing on a shared NFS directory is in fact the cause of the 
problem. This log message (which is just logged at INFO, and isn't truly an 
exception being thrown outside of log4j) is indicating that log4j could not 
close the file, which I believe it is necessary to do to rename it.

I'd assume the file could not be closed / renamed because someone was accessing 
it on the shared location and possibly even had it locked.

-Original Message-
From: ramakrishna menon [mailto:rmenon...@gmail.com] 
Sent: Friday, April 24, 2009 11:26 AM
To: Log4J Users List
Subject: Re: Log4j exception Could not close 
org.apache.log4j.helpers.CountingQuietWriter

Sure - thank you for a super prompt response! Here is my log4j configuration. 
The directory in which the application writes is a shared NFS directory if it 
makes any difference. But no other vm (tomcat) or application is writing to 
this directory...
# log4j properties file
#log4j.debug=true
log4j.rootLogger=WARN, R
#
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/data/etl/ssm/extractor/logs/extractor.log
log4j.appender.R.MaxFileSize=20MB
log4j.appender.R.MaxBackupIndex=30
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n # 
log4j.logger.com.opinmind=DEBUG log4j.logger.org.apache.commons.digester=debug


---
R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC 
Programming, http://www.amazon.com/exec/obidos/tg/detail/-/159059407X/
---


On Fri, Apr 24, 2009 at 8:10 AM, Matt Brown matt.br...@citrixonline.comwrote:

 Can you share your log4j configuration?

 -Original Message-
 From: ramakrishna menon [mailto:rmenon...@gmail.com]
 Sent: Friday, April 24, 2009 11:08 AM
 To: log4j-user@logging.apache.org
 Subject: Log4j exception Could not close 
 org.apache.log4j.helpers.CountingQuietWriter

 Hi I have a web application installed on a single tomcat instance.

 After around 2 to 5 days of running, the entire application stalls. 
 When checking the log, I get the following error stack. I did some 
 research on this on google but could not find any solution. What can I 
 do to avoid this situation? A tomcat bounce typically resolves the situation 
 temporarily.

 Thank you!
 Menon
 Apr 23, 2009 11:40:40 PM org.apache.catalina.core.StandardWrapperValve
 invoke
 INFO: log4j:ERROR Could not close
 org.apache.log4j.helpers.countingquietwri...@11361f82
 java.io.IOException: Input/output error
at java.io.FileOutputStream.close0(Native Method)
at java.io.FileOutputStream.close(FileOutputStream.java:279)
at
 sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:431)
at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)
at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)
at java.io.FilterWriter.close(FilterWriter.java:92)
at org.apache.log4j.FileAppender.closeFile(FileAppender.java:183)
at
 org.apache.log4j.RollingFileAppender.rollOver(RollingFileAppender.java:146)
at

 org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:239)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
at
 org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
at

 org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
at org.apache.log4j.Category.callAppenders(Category.java:203)
at org.apache.log4j.Category.forcedLog(Category.java:388)
at org.apache.log4j.Category.debug(Category.java:257)
at
 com.opinmind.db.DbUtil.executeDbProcAffectingRows(DbUtil.java:244)
at

 com.opinmind.webapp.exporter.AbstractExporter.logExtractorStats(AbstractExporter.java:139)
at

 com.opinmind.webapp.exporter.ExporterAssumingClientOnDbImpl.generateFile(ExporterAssumingClientOnDbImpl.java:138)
at

 com.opinmind.webapp.etl.extractor.DbDataExporter.getFiles(DbDataExporter.java:65)
at

 com.opinmind.webapp.etl.extractor.action.ExtractDbDataIntoFileAction.doExecute(ExtractDbDataIntoFileAction.java:71)
at com.opinmind.webapp.action.BaseAction.execute(BaseAction.java:50)
at

 org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at

 org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at

 org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

 ---
 R. M. Menon - A Rafi fan(www.mohdrafi.com) Author, Expert Oracle JDBC 
 Programming, http://www.amazon.com

RE: Client side logging

2009-04-21 Thread Matt Brown
You'll need to configure Jboss to send system out someplace else; the use of a 
ConsoleAppender does not mean that log4j automatically or magically redirects 
any calls to System.out to someplace else. 

When you say i am setting the Rolling appender as the root appender  then its 
child appender(Console Appender) message should also be stored in 
jbosswork1.log. Means all sysouts should come in  jbosswork1.log., I think you 
are misunderstanding the purpose or the way that ConsoleAppender works. 
ConsoleAppender will simply append log messages to the console - wherever that 
happens to be (whether it is an actual console or redirected to a file).

-Original Message-
From: div_gect [mailto:divya.g...@techblue.co.uk] 
Sent: Tuesday, April 21, 2009 10:24 AM
To: log4j-user@logging.apache.org
Subject: Client side logging


Hi all

Here i am executing a simple programme of log4j.

Here is programme-

import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;


public class first {

public static void main(String args[])

{
Logger logger=Logger.getLogger(first);
   
   DOMConfigurator.configure(c:\\log4j1.xml);

   System.out.println(This is  a sysout); 
logger.warn(Tsis is warning);
}

}


And here is log4j1.xml


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

   

appender name=ROLLING class=org.apache.log4j.FileAppender


layout class=org.apache.log4j.PatternLayout

 
/layout
   
  
 
   
/appender

appender name=CONSOLE1 class=org.apache.log4j.ConsoleAppender
   
  
  
  layout class=org.apache.log4j.PatternLayout
 
 
  /layout
   /appender

category name=first
priority value=DEBUG/
appender-ref ref=ROLLING/
/category

category name=org.apache
priority value=WARN/
/category

root
 
appender-ref ref=ROLLING/

/root

/log4j:configuration

  Now my issue is here as i am setting the Rolling appender as the root 
appender  then its child appender(Console Appender) message should also be 
stored in jbosswork1.log. Means all sysouts should come in  jbosswork1.log.
While it is not happening ,only warn message is getting stored. Here i am using 
eclipse Gynamede.
  
My requirment is to store all sysouts in log file.How can i perform it?
Should i provide some VM parameter.?Any suggestions most welcome.

Thanks
Divya Garg




--
View this message in context: 
http://www.nabble.com/Client-side-logging-tp23157248p23157248.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Is there any way to output the log statemts from a particular method to a different log file other than what is configued for that package?

2009-04-16 Thread Matt Brown
A pretty simple solution would be to have each method use two different Logger 
objects (with different names).

-Original Message-
From: Vani Bandargal [mailto:vanims...@hotmail.com] 
Sent: Thursday, April 16, 2009 10:05 AM
To: log4j-user@logging.apache.org
Subject: Is there any way to output the log statemts from a particular method 
to a different log file other than what is configued for that package?


Is there any way to output the log statemts from a particular method to a 
different log file other than what is configued for that package?

In other words a 2 log files for a package. First log file for some methods and 
the second one is for other methods.

p

Ex:  package com.foo.p1

public class Tset{

private metgod 1{
//log should output in Log File1
}

private metgod2{
//log should output in Log File2
}


}

/p
--
View this message in context: 
http://www.nabble.com/Is-there-any-way-to-output-the-log-statemts-from-a-particular-method-to-a-different-log-file-other-than-what-is-configued-for-that-package--tp23078688p23078688.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Is there any way to output the log statemts from a particular method to a different log file other than what is configued for that package?

2009-04-16 Thread Matt Brown
You have this configuration:

log4j.logger.package1.delegate=ERROR, database1
log4j.logger.package1.delegate=ERROR, database2

Yet with this code, you are using the loggers named databaselog1 and 
databaselog2:

private static Logger logger1 = Logger.getLogger(databaselog1); 
private static Logger logger2 = Logger.getLogger(databaselog2);

So you should be configuring it like this

log4j.logger.databaselog1=ERROR, database1
log4j.logger.databaselog2=ERROR, database2

But also, if you only configure the logger to log at ERROR level, then when you 
log with log.info() in the actual source code, this INFO level message will be 
ignored, since it falls below the threshold.

For your testing, try

log4j.logger.databaselog1=ALL, database1
log4j.logger.databaselog2=ALL, database2 

-Original Message-
From: Vani Bandargal [mailto:vanims...@hotmail.com] 
Sent: Thursday, April 16, 2009 12:31 PM
To: log4j-user@logging.apache.org
Subject: RE: Is there any way to output the log statemts from a particular 
method to a different log file other than what is configued for that package?


I have attched the log4J properties file and a sample delegate that I used.

Please take a look. Appreciate if you point out what I am missing.

All my log statements are printed in root.log. They are neither going to
databaselog1 and nor to databaselog2
http://www.nabble.com/file/p23081601/Log4J.properties.txt
Log4J.properties.txt 

http://www.nabble.com/file/p23081601/SampleDelegate.txt SampleDelegate.txt
--
View this message in context: 
http://www.nabble.com/Is-there-any-way-to-output-the-log-statemts-from-a-particular-method-to-a-different-log-file-other-than-what-is-configued-for-that-package--tp23078688p23081601.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Is there any way to output the log statemts from a particular method to a different log file other than what is configued for that package?

2009-04-16 Thread Matt Brown
http://logging.apache.org/log4j/1.2/manual.html Take a look at the section on 
Appender Additivity.

 

-Original Message-
From: Vani Bandargal [mailto:vanims...@hotmail.com] 
Sent: Thursday, April 16, 2009 1:18 PM
To: log4j-user@logging.apache.org
Subject: RE: Is there any way to output the log statemts from a particular 
method to a different log file other than what is configued for that package?


Matt, Incredible...Thanks for helping me out. 

 I can now see the database1 log file contains log from method1 and
database2
log file contains log from method2. 

On a side note(not a big deal)both logs from method1 and method2 are outputted 
in root log too(along with what is specified) Is there any way to stop it 
outputting in root log. 

Thanks.

--
View this message in context: 
http://www.nabble.com/Is-there-any-way-to-output-the-log-statemts-from-a-particular-method-to-a-different-log-file-other-than-what-is-configued-for-that-package--tp23078688p23082558.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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



RE: Custom Appender works fine with rootlogger, but not when logger specified

2009-03-19 Thread Matt Brown
It sounds like instead of using a logger named com.company.blah.MyClass, your 
code is asking log4j for a logger named simply MyClass.

Therefore when your log4j.properties configuration refers to the logger named 
MyClass, it works as you expect; but when you attempt to configure the logger 
named com.company.blah.MyClass, nothing happens - because no code is sending 
any log messages to a logger with that name.

 

-Original Message-
From: Guy [mailto:guy.van.tilbo...@gmail.com] 
Sent: Thursday, March 19, 2009 10:16 AM
To: Log4J Users List
Subject: Re: Custom Appender works fine with rootlogger, but not when logger 
specified

Thanks Simon,

but my problem was caused by the following lines during activateOptions():

//set the name to the className as name of the appender.
//This will always be the name of the actual class (I have more than one 
appender, some extending the other) String classname = 
this.getClass().getName(); classname = 
classname.substring(classname.lastIndexOf(.) +1); this.setName(classname);

I don't even know anymore why I thought this would be a good idea, but 
ommenting the code solved the problem.

I am curious how that code was the cause of the problem, but the problem itself 
is solved

Guy



On Thu, Mar 19, 2009 at 3:06 PM, Simon Park simon_park_m...@yahoo.co.uk wrote:
 Hi,

 Take a look at the 
 http://www.simonsite.org.uk/javadoc/org/apache/log4j/appender/TimeAndSizeRollingAppender.html.
   Source is available in the JAR at 
 http://www.simonsite.org.uk/resources/lib/log4j-rolling-appender.jar.  This 
 appender does a similar thing to your custom appender by the sounds of it.

 Simon




 
 From: Guy guy.van.tilbo...@gmail.com
 To: log4j-user@logging.apache.org
 Sent: Thursday, 19 March, 2009 9:48:51
 Subject: Custom Appender works fine with rootlogger, but not when 
 logger  specified

 Hi,

 I have written a custom appender that adds file rotation and zipping 
 of the rotated files. Some other custom functionality is added. What I 
 do is: when a file has reached a certain size, I close the file, 
 rename it and compress it. After the rename, I reset the file. The 
 renaming of the file is where it all goes wrong.


 Everything works fine if I stick to using the rootLogger:

 Defining of our custom appender

 log4j.rootLogger=INFO, ddm

 #THIS WORKS FINE
 #log4j.logger.mylogger=INFO


 #THIS DOES NOT WORK FINE. Note That we do not even write to this 
 logger (class) log4j.logger.be.package=INFO, mylogger


 SO for some reason, using the line log4j.logger.be.package=INFO, 
 mylogger creates an object that prevents the rename from taking 
 place.

 I have looked at the RollingFileAppender about closing the 
 file/writing to the stream, but as far as I can see, I do the same. I 
 could also rewrite my custom appender starting from the 
 RollingFileAppender, but that is something I want to prevent

 Any help would be apreciated

 Guy

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




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


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