Re: log4j initialization problem

2007-08-16 Thread Tonny Staunsbrink
Hi All
Another way to "bundle" your log4j.properties is to include it in the
framework /application jar and then use the log4j.conifguration system
property if you need to change the defaults in teh deployment environment.
That way there is no log4j configuration code in the application/framework
java files. It does require a litte tweak to the build files though.

Cheers
Tonny

On 8/15/07, Chuck Hill <[EMAIL PROTECTED]> wrote:
>
>
> On Aug 15, 2007, at 9:25 AM, James Cicenia wrote:
>
> > LOL !
> >
> > I instead used URL, just as Chuck was probably writing his reply.
> >
> > HOWEVER!!!
> >
> > for some reason if I just put a static string in the argument it
> > worked?!
> > i.e.
> > PropertyConfigurator.configure("/blah/blah/blah/log4j.properties)
> >
> > That I don't understand.
>
> Because aUrl.toString() is not the same as the static path.
>
> Chuck
>
> >
> > Best to have it here in the archives.
> >
> > James
> >
> > On Aug 15, 2007, at 11:10 AM, Steven Mark McCraw wrote:
> >
> >> Don't leave us hanging ;-) What was the fix?
> >> On Aug 15, 2007, at 12:04 PM, James Cicenia wrote:
> >>
> >>> never mind.
> >>>
> >>>
> >>> On Aug 15, 2007, at 10:22 AM, James Cicenia wrote:
> >>>
>  Hello -
> 
>  I am now getting serious.   ;-)
> 
>  I want to use logging and in particular log4j.
> 
>  In my Application constructor I have:
> 
>  String log4jFile = resourceManager().pathURLForResourceNamed
>  ("log4j.properties", null, null).toString();
> 
>  then I have:
> 
>  System.out.println("Log4j file (from .woa): " + log4jFile);
>  PropertyConfigurator.configure(log4jFile);
>  log = Logger.getLogger( Application.class );
>  log.debug("Log4j has been initialized");
> 
>  And I get this outputed in my current log:
> 
>  Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/
>  Applications/Blakey.woa/Contents/Resources/log4j.properties
>  log4j:ERROR Could not read configuration file [file:/usr/local/
>  apple/Library/WebObjects/Applications/Blakey.woa/Contents/
>  Resources/log4j.properties].
>  java.io.FileNotFoundException: file:/usr/local/apple/Library/
>  WebObjects/Applications/Blakey.woa/Contents/Resources/
>  log4j.properties (No such file or directo
>  ry)
>  at java.io.FileInputStream.open(Native Method)
>  at java.io.FileInputStream.(FileInputStream.java:106)
>  at java.io.FileInputStream.(FileInputStream.java:66)
>  at org.apache.log4j.PropertyConfigurator.doConfigure
>  (PropertyConfigurator.java:297)
>  at org.apache.log4j.PropertyConfigurator.configure
>  (PropertyConfigurator.java:315)
>  at com.tos.Application.(Application.java:242)
> 
> 
>  HOWEVER that file referenced is there and with completely opened
>  permissions (777)
> 
>  What obvious thing am I doing wrong?
> 
>  Thanks
>  James Cicenia
> 
>  ___
>  Do not post admin requests to the list. They will be ignored.
>  Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
>  Help/Unsubscribe/Update your Subscription:
>  http://lists.apple.com/mailman/options/webobjects-dev/james%
>  40jimijon.com
> 
>  This email sent to [EMAIL PROTECTED]
> >>>
> >>> ___
> >>> Do not post admin requests to the list. They will be ignored.
> >>> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> >>> Help/Unsubscribe/Update your Subscription:
> >>> http://lists.apple.com/mailman/options/webobjects-dev/mark%
> >>> 40bluecollarsoftware.com
> >>>
> >>> This email sent to [EMAIL PROTECTED]
> >>>
> >>
> >
> > ___
> > Do not post admin requests to the list. They will be ignored.
> > Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/webobjects-dev/chill%
> > 40global-village.net
> >
> > This email sent to [EMAIL PROTECTED]
> >
>
> --
>
> Practical WebObjects - for developers who want to increase their
> overall knowledge of WebObjects or who are trying to solve specific
> problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
> ___
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/mezz.dk%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman

Re: log4j initialization problem

2007-08-15 Thread Chuck Hill


On Aug 15, 2007, at 9:25 AM, James Cicenia wrote:


LOL !

I instead used URL, just as Chuck was probably writing his reply.

HOWEVER!!!

for some reason if I just put a static string in the argument it  
worked?!

i.e.
PropertyConfigurator.configure("/blah/blah/blah/log4j.properties)

That I don't understand.


Because aUrl.toString() is not the same as the static path.

Chuck



Best to have it here in the archives.

James

On Aug 15, 2007, at 11:10 AM, Steven Mark McCraw wrote:


Don't leave us hanging ;-) What was the fix?
On Aug 15, 2007, at 12:04 PM, James Cicenia wrote:


never mind.


On Aug 15, 2007, at 10:22 AM, James Cicenia wrote:


Hello -

I am now getting serious.   ;-)

I want to use logging and in particular log4j.

In my Application constructor I have:

String log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null).toString();


then I have:

System.out.println("Log4j file (from .woa): " + log4jFile);
PropertyConfigurator.configure(log4jFile);
log = Logger.getLogger( Application.class );
log.debug("Log4j has been initialized");

And I get this outputed in my current log:

Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/ 
Applications/Blakey.woa/Contents/Resources/log4j.properties
log4j:ERROR Could not read configuration file [file:/usr/local/ 
apple/Library/WebObjects/Applications/Blakey.woa/Contents/ 
Resources/log4j.properties].
java.io.FileNotFoundException: file:/usr/local/apple/Library/ 
WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties (No such file or directo

ry)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at org.apache.log4j.PropertyConfigurator.doConfigure 
(PropertyConfigurator.java:297)
at org.apache.log4j.PropertyConfigurator.configure 
(PropertyConfigurator.java:315)

at com.tos.Application.(Application.java:242)


HOWEVER that file referenced is there and with completely opened  
permissions (777)


What obvious thing am I doing wrong?

Thanks
James Cicenia

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/james% 
40jimijon.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mark% 
40bluecollarsoftware.com


This email sent to [EMAIL PROTECTED]





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 
40global-village.net


This email sent to [EMAIL PROTECTED]



--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: log4j initialization problem

2007-08-15 Thread James Cicenia

LOL !

I instead used URL, just as Chuck was probably writing his reply.

HOWEVER!!!

for some reason if I just put a static string in the argument it  
worked?!

i.e.
PropertyConfigurator.configure("/blah/blah/blah/log4j.properties)

That I don't understand.

Best to have it here in the archives.

James

On Aug 15, 2007, at 11:10 AM, Steven Mark McCraw wrote:


Don't leave us hanging ;-) What was the fix?
On Aug 15, 2007, at 12:04 PM, James Cicenia wrote:


never mind.


On Aug 15, 2007, at 10:22 AM, James Cicenia wrote:


Hello -

I am now getting serious.   ;-)

I want to use logging and in particular log4j.

In my Application constructor I have:

String log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null).toString();


then I have:

System.out.println("Log4j file (from .woa): " + log4jFile);
PropertyConfigurator.configure(log4jFile);
log = Logger.getLogger( Application.class );
log.debug("Log4j has been initialized");

And I get this outputed in my current log:

Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/ 
Applications/Blakey.woa/Contents/Resources/log4j.properties
log4j:ERROR Could not read configuration file [file:/usr/local/ 
apple/Library/WebObjects/Applications/Blakey.woa/Contents/ 
Resources/log4j.properties].
java.io.FileNotFoundException: file:/usr/local/apple/Library/ 
WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties (No such file or directo

ry)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at org.apache.log4j.PropertyConfigurator.doConfigure 
(PropertyConfigurator.java:297)
at org.apache.log4j.PropertyConfigurator.configure 
(PropertyConfigurator.java:315)

at com.tos.Application.(Application.java:242)


HOWEVER that file referenced is there and with completely opened  
permissions (777)


What obvious thing am I doing wrong?

Thanks
James Cicenia

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/james% 
40jimijon.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mark% 
40bluecollarsoftware.com


This email sent to [EMAIL PROTECTED]





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: log4j initialization problem

2007-08-15 Thread Steven Mark McCraw

Don't leave us hanging ;-) What was the fix?
On Aug 15, 2007, at 12:04 PM, James Cicenia wrote:


never mind.


On Aug 15, 2007, at 10:22 AM, James Cicenia wrote:


Hello -

I am now getting serious.   ;-)

I want to use logging and in particular log4j.

In my Application constructor I have:

String log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null).toString();


then I have:

System.out.println("Log4j file (from .woa): " + log4jFile);
PropertyConfigurator.configure(log4jFile);
log = Logger.getLogger( Application.class );
log.debug("Log4j has been initialized");

And I get this outputed in my current log:

Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/ 
Applications/Blakey.woa/Contents/Resources/log4j.properties
log4j:ERROR Could not read configuration file [file:/usr/local/ 
apple/Library/WebObjects/Applications/Blakey.woa/Contents/ 
Resources/log4j.properties].
java.io.FileNotFoundException: file:/usr/local/apple/Library/ 
WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties (No such file or directo

ry)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at org.apache.log4j.PropertyConfigurator.doConfigure 
(PropertyConfigurator.java:297)
at org.apache.log4j.PropertyConfigurator.configure 
(PropertyConfigurator.java:315)

at com.tos.Application.(Application.java:242)


HOWEVER that file referenced is there and with completely opened  
permissions (777)


What obvious thing am I doing wrong?

Thanks
James Cicenia

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/james% 
40jimijon.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mark% 
40bluecollarsoftware.com


This email sent to [EMAIL PROTECTED]



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: log4j initialization problem

2007-08-15 Thread Chuck Hill


On Aug 15, 2007, at 8:22 AM, James Cicenia wrote:


Hello -

I am now getting serious.   ;-)

I want to use logging and in particular log4j.

In my Application constructor I have:

String log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null).toString();


Try

URL log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null);


FWIW, I find the XML format to be much easier to understand and  
maintain.


Chuck


then I have:

System.out.println("Log4j file (from .woa): " + log4jFile);
PropertyConfigurator.configure(log4jFile);
log = Logger.getLogger( Application.class );
log.debug("Log4j has been initialized");

And I get this outputed in my current log:

Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/ 
Applications/Blakey.woa/Contents/Resources/log4j.properties
log4j:ERROR Could not read configuration file [file:/usr/local/ 
apple/Library/WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties].
java.io.FileNotFoundException: file:/usr/local/apple/Library/ 
WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties (No such file or directo

ry)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at org.apache.log4j.PropertyConfigurator.doConfigure 
(PropertyConfigurator.java:297)
at org.apache.log4j.PropertyConfigurator.configure 
(PropertyConfigurator.java:315)

at com.tos.Application.(Application.java:242)


HOWEVER that file referenced is there and with completely opened  
permissions (777)


What obvious thing am I doing wrong?

Thanks
James Cicenia

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 
40global-village.net


This email sent to [EMAIL PROTECTED]



--

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.

http://www.global-village.net/products/practical_webobjects





___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: log4j initialization problem

2007-08-15 Thread James Cicenia

never mind.


On Aug 15, 2007, at 10:22 AM, James Cicenia wrote:


Hello -

I am now getting serious.   ;-)

I want to use logging and in particular log4j.

In my Application constructor I have:

String log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null).toString();


then I have:

System.out.println("Log4j file (from .woa): " + log4jFile);
PropertyConfigurator.configure(log4jFile);
log = Logger.getLogger( Application.class );
log.debug("Log4j has been initialized");

And I get this outputed in my current log:

Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/ 
Applications/Blakey.woa/Contents/Resources/log4j.properties
log4j:ERROR Could not read configuration file [file:/usr/local/ 
apple/Library/WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties].
java.io.FileNotFoundException: file:/usr/local/apple/Library/ 
WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties (No such file or directo

ry)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at org.apache.log4j.PropertyConfigurator.doConfigure 
(PropertyConfigurator.java:297)
at org.apache.log4j.PropertyConfigurator.configure 
(PropertyConfigurator.java:315)

at com.tos.Application.(Application.java:242)


HOWEVER that file referenced is there and with completely opened  
permissions (777)


What obvious thing am I doing wrong?

Thanks
James Cicenia

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/james% 
40jimijon.com


This email sent to [EMAIL PROTECTED]


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


log4j initialization problem

2007-08-15 Thread James Cicenia

Hello -

I am now getting serious.   ;-)

I want to use logging and in particular log4j.

In my Application constructor I have:

String log4jFile = resourceManager().pathURLForResourceNamed 
("log4j.properties", null, null).toString();


then I have:

System.out.println("Log4j file (from .woa): " + log4jFile);
PropertyConfigurator.configure(log4jFile);
log = Logger.getLogger( Application.class );
log.debug("Log4j has been initialized");

And I get this outputed in my current log:

Log4j file (from .woa): file:/usr/local/apple/Library/WebObjects/ 
Applications/Blakey.woa/Contents/Resources/log4j.properties
log4j:ERROR Could not read configuration file [file:/usr/local/apple/ 
Library/WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties].
java.io.FileNotFoundException: file:/usr/local/apple/Library/ 
WebObjects/Applications/Blakey.woa/Contents/Resources/ 
log4j.properties (No such file or directo

ry)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at org.apache.log4j.PropertyConfigurator.doConfigure 
(PropertyConfigurator.java:297)
at org.apache.log4j.PropertyConfigurator.configure 
(PropertyConfigurator.java:315)

at com.tos.Application.(Application.java:242)


HOWEVER that file referenced is there and with completely opened  
permissions (777)


What obvious thing am I doing wrong?

Thanks
James Cicenia

___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]