From: laredotornado on
Hi,

According to the documentation, if I use the Logger.getLogger(String)
method, the parameter refers to the name of the log file. Where do I
define that? Does this go in my log4j properties file?

A very beginner question, but any help you cah provide is appreciated,
- Dave
From: conrad on
laredotornado wrote:
> According to the documentation, if I use the Logger.getLogger(String)
> method, the parameter refers to the name of the log file.  Where do I
> define that?  Does this go in my log4j properties file?

Your mention of the log4j properties file indicates that you are using
org.apache.log4j.Logger and not java.util.logging.Logger. Since both
are quite popular, it's important to know of which one we speak.

As it happens, for neither one does the method
public static Logger getLogger(java.lang.String name)
use the name argument to specify the name of the log file. For both,
the 'name' argument specifies an identifier for the Logger instance
itself. It would be pathological to put the name of the log file as
the argument to that method. The usual practice for log4j is to name
the logger after the class in which it is used, e.g.,

package com.lewscanon.foo;
import org.apache.log4j.Logger;
public class Foo
{
private final Logger logger = Logger.getLogger( Foo.class );
...

As you surmise, the definition for the log4j log file goes in the
log4j properties file. This is c covered in the section on
"Appenders" in
<http://logging.apache.org/log4j/1.2/manual.html>

--
Lew