When I click on mail-archives.apache.org for log4j-user I see the log4j-dev.

2007-11-12 Thread [EMAIL PROTECTED]

Hi,

I think there is a error in the link for mail-archives.apache.org 
log4j-user here :

http://logging.apache.org/log4j/1.2/mail-lists.html

When I click on mail-archives.apache.org for log4j-user I see the log4j-dev
not the log4j-user .

Regards,

Pierre8r


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



Advantages of using static log methods vs sub classes methods

2007-11-12 Thread Integrator

Hi ,

I am comparing the advantages and disadvantages using log4j at its own vs
some sub classes (or wrapper classes) with methods for logging messages from
application.


Which one is better and why ? So far i could understand Utilization of
wrapper ensures that you are not tied to specific logging solutions.

Is that it or there is something more ? Please express your views and
experience on it.

Thanks,
Integrator

-- 
View this message in context: 
http://www.nabble.com/Advantages-of-using-static-log-methods-vs-sub-classes-methods-tf4793407.html#a13712766
Sent from the Log4j - Users mailing list archive at Nabble.com.


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



Re: Advantages of using static log methods vs sub classes methods

2007-11-12 Thread James A. N. Stauffer
A wrapper class (if you use something I suggest that you use something that
is has been well-tested like commons-logging instead of writing your own)
allows you to switch logger implementations but probably prohibits the use
of some functionality.  I would suggest using a wrapper only if you foresee
the need to change logger (i.e. if you are writing a framework and want to
leave the logger choice to someone else).

On Nov 12, 2007 1:46 PM, Integrator [EMAIL PROTECTED] wrote:


 Hi ,

 I am comparing the advantages and disadvantages using log4j at its own vs
 some sub classes (or wrapper classes) with methods for logging messages
 from
 application.


 Which one is better and why ? So far i could understand Utilization of
 wrapper ensures that you are not tied to specific logging solutions.

 Is that it or there is something more ? Please express your views and
 experience on it.

 Thanks,
 Integrator

 --
 View this message in context:
 http://www.nabble.com/Advantages-of-using-static-log-methods-vs-sub-classes-methods-tf4793407.html#a13712766
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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




-- 
James A. N. Staufferhttp://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/


Re: Advantages of using static log methods vs sub classes methods

2007-11-12 Thread Integrator

The loggers instance are being generated from a factory pattern in a j2ee
aplication and implements the log methods from wrapper class. Rather then
calling default logging methods from Logger (Catagory) Class. 

Thanks.


James A. N. Stauffer wrote:
 
 A wrapper class (if you use something I suggest that you use something
 that
 is has been well-tested like commons-logging instead of writing your own)
 allows you to switch logger implementations but probably prohibits the use
 of some functionality.  I would suggest using a wrapper only if you
 foresee
 the need to change logger (i.e. if you are writing a framework and want to
 leave the logger choice to someone else).
 
 On Nov 12, 2007 1:46 PM, Integrator [EMAIL PROTECTED] wrote:
 

 Hi ,

 I am comparing the advantages and disadvantages using log4j at its own vs
 some sub classes (or wrapper classes) with methods for logging messages
 from
 application.


 Which one is better and why ? So far i could understand Utilization of
 wrapper ensures that you are not tied to specific logging solutions.

 Is that it or there is something more ? Please express your views and
 experience on it.

 Thanks,
 Integrator

 --
 View this message in context:
 http://www.nabble.com/Advantages-of-using-static-log-methods-vs-sub-classes-methods-tf4793407.html#a13712766
 Sent from the Log4j - Users mailing list archive at Nabble.com.


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


 
 
 -- 
 James A. N. Staufferhttp://www.geocities.com/stauffer_james/
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 

-- 
View this message in context: 
http://www.nabble.com/Advantages-of-using-static-log-methods-vs-sub-classes-methods-tf4793407.html#a13713254
Sent from the Log4j - Users mailing list archive at Nabble.com.


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



file location - windows vista

2007-11-12 Thread epic winter

I have an application using log4j and in the past I have just specified: 
log4j.appender.file.File=logfilename.log

This would create the file in the location where the java app was launched.  
This was in C:\program files\MyApp\logfilename.log

But windows vista doesn't seem to allow my program to write anywhere in 
c:\program files.  I assume that log file is not being written at all now 
because of these permissions.  Correct?

I guess my solution is to write the log file to a folder in the user's home 
directory.  Is there a way to auto specify the user's home directory without 
hard coding it?

thanks
-ryan

_
Help yourself to FREE treats served up daily at the Messenger Café. Stop by 
today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline

RE: Advantages of using static log methods vs sub classes methods

2007-11-12 Thread Bender Heri
I would use wrappers, if at all, only for app or module wide special loggers 
(like fatal error alerting etc.), and only 
- if there is a special need to do something with the log event which cannot be 
done using the log4j framework 
- if some special initializing of the involved appenders is needed which cannot 
be done through configuration.

For debugging purpose I would recommend to use it the usual way (each class has 
its private logger instance which is named after the fully qualified 
classname). 
Advantages:
- you keep the main benefit of log4j to finetune your log output depending on 
classes or packages per configuration without changing code. 
- you can reuse some basic classes in other apps without to have carry over 
your log wrapper. Applies also to unit testing which can be done without the 
need of initializing the wrapper framework.

Disadvantages of wrapper:
- wrapper instances have to be carried all along the callstack or must be 
accessible in a static way.
- Danger of unwanted dependencies (also circular) grows.

Heri

 -Original Message-
 From: Integrator [mailto:[EMAIL PROTECTED]
 Sent: Monday, November 12, 2007 8:47 PM
 To: log4j-user@logging.apache.org
 Subject: [SPAM (Bayesain Analysis)] - Advantages of using static log
 methods vs sub classes methods - Bayesian Filter detected spam
 
 
 
 Hi ,
 
 I am comparing the advantages and disadvantages using log4j 
 at its own vs
 some sub classes (or wrapper classes) with methods for 
 logging messages from
 application.
 
 
 Which one is better and why ? So far i could understand Utilization of
 wrapper ensures that you are not tied to specific logging solutions.
 
 Is that it or there is something more ? Please express your views and
 experience on it.
 
 Thanks,
 Integrator
 
 -- 
 View this message in context: 
 http://www.nabble.com/Advantages-of-using-static-log-methods-v
 s-sub-classes-methods-tf4793407.html#a13712766
 Sent from the Log4j - Users mailing list archive at Nabble.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]



Copying MDC values for multithreaded apps

2007-11-12 Thread Matthew Kemp
I'm working on an app where we have a decorator Log4JRunnable class that
used to wrap runnables submitted to a thread pool. It retrieves a copy of
the MDC from the submitting thread (code included below). The problem that I
am running into is that occasionally a ConcurrentModificationException is
being thrown when I iterate over the entries in the hashtable. I've looked
of the Log4J and JDK code an couldn't find anything that stuck out. I know
that this might now be a Log4J specific problem, but maybe there's something
I missed. Any insight into this would be appreciated.

Thanks in advance.

Matt


public class Log4JRunnable implements Runnable {

private final Runnable runnable;
private final Hashtable mdc;

public Log4JRunnable(Runnable runnable) {
runnable = runnable;
mdc = (MDC.getContext() != null) ? (Hashtable) MDC.getContext
().clone() : null;
}

public void run() {
if (mdc != null) {
for (Iterator i = mdc.entrySet().iterator(); i.hasNext(); ) {
// getting ConcurrentModificationException here
Map.Entry entry = (Map.Entry) i.next();
MDC.put((String) entry.getKey(), entry.getValue());
}
}

runnable.run();

if (mdc != null) {
for (Iterator i = mdc.entrySet().iterator(); i.hasNext(); ) {
Map.Entry entry = (Map.Entry) i.next();
MDC.remove((String) entry.getKey());
}
}
}
}