users@glassfish.java.net

Re: Unable to load logging property /Log4J.properties

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 11 Aug 2009 14:58:29 -0700

On 08/11/09 12:25, glassfish_at_javadesktop.org wrote:
> I created a method:
>
> ---------------------------
> static final String LOG_PROPERTIES_FILE = "/Log4J.properties";
>
> private void initializeLogger()
> {
> Properties logProperties = new Properties();
>
> try
> {
> logProperties.load(new FileInputStream(LOG_PROPERTIES_FILE));
> PropertyConfigurator.configure(logProperties);
> logger.info("Logging initialized.");
> }
> catch(IOException e)
> {
> throw new RuntimeException("Unable to load logging property " + LOG_PROPERTIES_FILE);
> }
> }
>
> ----------------------
>
> However when I called initializeLogger(); I got the exception message:
>
> "Unable to load logging property /Log4J.properties"
>
> Would you please advise me how to fix this?
>

Where did you bundle your log4j.properties resource, and from where are you
trying to access it?

I suggest storing it in WEB-INF/classes, and then accessing it via the
getResource() or getResourceAsStream() method of your web application's
classloder.


Jan


> Thanks a lot.
> [Message sent by forum member 'henryliu' (henryliu)]
>
> http://forums.java.net/jive/thread.jspa?messageID=359956
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>