You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Lutz Michael <mi...@siemens.com> on 2004/11/11 15:58:05 UTC

RE: Can4t write logs


One thing that's "unusual" - using the root logger.  It's generally
recommended to use the getLogger method and name your loggers with the class
FQCN, else you lose much of the power of Log4j (see
http://logging.apache.org/log4j/docs/manual.html).

Q: did you see the console output, and did you not see the output in the
file or did you not find the file?


-----Original Message-----
From: Javier [mailto:xleyba@yahoo.com]
Sent: Thursday, November 11, 2004 9:44 AM
To: log4j-user@logging.apache.org
Subject: Can4t write logs


Hello

I?m using log4j by the first time.

I did the following properties file:

----------------
# Set root logger level to DEBUG and its only appender
to A1.
log4j.rootLogger=INFO, stdout, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=apliA.log
log4j.appender.A1.maxFileSize=1MB
log4j.appender.A1.maxBackupIndex=3

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%p %t %c -
%m%n

# stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line
number.
log4j.appender.stdout.layout.ConversionPattern=%5p
[%t] (%F:%L) - %m%n
------------

and in my code I did:

 PropertyConfigurator pcconfig = new
PropertyConfigurator();
        pcconfig.configure("aprop.properties");

        logger = Logger.getRootLogger();
        logger.info("Entering application.");


but when I run the application, I saw "entering
aplication" was not wrote in log file...

What am I doing wrong ?

Thanks in advance

Javier

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to Central.SecurityOffice@shs.siemens.com 

Thank you

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


RE: Can4t write logs

Posted by Javier <xl...@yahoo.com>.
> 
> One thing that's "unusual" - using the root logger. 
> It's generally
> recommended to use the getLogger method and name
> your loggers with the class
> FQCN, else you lose much of the power of Log4j (see
> http://logging.apache.org/log4j/docs/manual.html).

Thanks for your reply.

Yes, I�ve read the manual but I really don�t
understand this point..

What do you mean with use getLogger with the class.
Which class should I use ? Should I place my
application class name as a parameter to getLogger ?

My application is a little (but powerfull, jeje) class
a file...and only one.



> 
> Q: did you see the console output, and did you not
> see the output in the
> file or did you not find the file?

I see the file but nothing inside. Also, I see nothing
in console output..


thanks in advance
Javier




		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


RE: Can4t write logs

Posted by Javier <xl...@yahoo.com>.
> 
> One thing that's "unusual" - using the root logger. 
> It's generally
> recommended to use the getLogger method and name
> your loggers with the class
> FQCN, else you lose much of the power of Log4j (see
> http://logging.apache.org/log4j/docs/manual.html).
> 


Hi

I�ve been reading the doc again and now I see the
light :)

Then my application now use this:

------------
private static Logger logger =
Logger.getLogger("AplicacionA.class");

PropertyConfigurator.configure("aprop.properties");
        logger.info("Entering application.");

--------------

Now I�ve a new problem (partially solved): if I not
pass a full path to configure method, it can't find my
properties file.

It�s normal this ?
How could I get the current application path ? (I
could imagine writeing a file and getting a path, but
I want to know if there are a more "sophisticated"
method..).

Thanks in advance

Javier


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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