nulll | 1 Apr 21:10 2011
Picon

log4j on WebSphere Application Server


Hi,

I configured my logging with log4j.properties file using a FileAppender.
When I do my local development, I use Tomcat under Windows.
When deploying on managed-environments (sys, acc, prod), I use WebSphere
under Linux.

Since my various environment use dedicated file structure, I'd like to know
how I can set a log file location which is dynamic.
I would actually want to have my log4j logging written into a file in the
same folder as SystemOut.log.
I defined a LOG_ROOT WebSphere variable but I don't think it's accessible to
LOG4J.

I made some research on the Internet but still didn't find any way to do
that.

Any help is appreciated.

Thanks!
--

-- 
View this message in context: http://old.nabble.com/log4j-on-WebSphere-Application-Server-tp31298324p31298324.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
Jacob Kjome | 2 Apr 06:45 2011

Re: log4j on WebSphere Application Server

You can reference Java system properties using the syntaxt ${somePropertyName},
e.g.,....

log4j.appender.A1.File=${log.dir}/stdout.log

You can set Java system properties on the command line using...

java -Dlog.dir=/path/to/log/directory ....

Jake

On 4/1/2011 1:10 PM, nulll wrote:
> 
> Hi,
> 
> I configured my logging with log4j.properties file using a FileAppender.
> When I do my local development, I use Tomcat under Windows.
> When deploying on managed-environments (sys, acc, prod), I use WebSphere
> under Linux.
> 
> Since my various environment use dedicated file structure, I'd like to know
> how I can set a log file location which is dynamic.
> I would actually want to have my log4j logging written into a file in the
> same folder as SystemOut.log.
> I defined a LOG_ROOT WebSphere variable but I don't think it's accessible to
> LOG4J.
> 
> I made some research on the Internet but still didn't find any way to do
> that.
> 
(Continue reading)

Jacob Kjome | 2 Apr 07:05 2011

Re: Why There isn't a Log File?


You can use an XML config file just fine under Tomcat (with caveats... see below).
 I see two issues with your current XML config, though....

1.  The doctype should be...

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

2.  The path in...

<param name="File" value="c:\myproj\myapp\logs\mylog.log" />

...should be either...

<param name="File" value="c:\\myproj\\myapp\\logs\\mylog.log" />

...or...

<param name="File" value="c:/myproj/myapp/logs/mylog.log" />

I mentioned a caveat above about using XML config files in Tomcat.  By that, I
mean using it specifically for Tomcat logging, not just general application
logging.  You can, unless you choose to reference Tomcat loggers named using
square brackets, as they are disallowed by the DTD.  For instance, to reference
Tomcat's "localhost" logger, you'd use...

org.apache.catalina.core.ContainerBase.[Catalina].[localhost]

Using XML, it would be...

(Continue reading)

joseheitor | 4 Apr 11:04 2011

'Rolling' Single Log File


Is it possible to log to a single log file with a size limit, which when the
size limit is reached, the oldest entries get automatically removed as it
adds new log events?
--

-- 
View this message in context: http://old.nabble.com/%27Rolling%27-Single-Log-File-tp31312523p31312523.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
Mikhail T. | 4 Apr 17:49 2011

Re: 'Rolling' Single Log File

On 04.04.2011 05:04, joseheitor wrote:
> Is it possible to log to a single log file with a size limit, which when the
> size limit is reached, the oldest entries get automatically removed as it
> adds new log events?
No filesystem allows such removal of beginning of a file, so the answer 
is a no.

If you were logging to a database's table, you could do something like 
this, but plain file -- no.

    -mi
Maor Bril | 12 Apr 09:08 2011

RE: NULL's in log

Hi All

every once in a while I get a corrupted log file with a very long
sequence on NULL's where the text should be

this happens once in 3-4 days on sporadic occations.

I use a static synchronized class for all the threads who want to write
to the log file access

this is due to the fact I need to output the message to a GUI screen as
well.

both the methods and the actual access to the log are synchronized.

example

public static synchronized logOut(Object message) {

      synchronized(log) {

           log.info(message)

     }

  // Do other stuff with message.

}

please advise..,. as the NULL's renders the system unreliable.
(Continue reading)

Maor Bril | 17 Apr 09:55 2011

NULL's in log

Hi All

Every once in a while I get a corrupted log file with a very long
sequence on NULL's where the text should be

This happens once in 3-4 days on sporadic occasions.

I use a static synchronized class for all the threads who want to write
to the log file access

This is due to the fact I need to output the message to a GUI screen as
well.

Both the methods and the actual access to the log are synchronized.

Example

public static synchronized logOut(Object message) {

      synchronized(log) {

           log.info(message)

     }

  // Do other stuff with message.

}

Please advise..,. as the NULL's renders the system unreliable.
(Continue reading)

Amit Oberoi | 17 Apr 10:09 2011

RE: NULL's in log

How does your Logger configuration looks like. I presume the problem is the way you are initiating/
declaring your Logger.

Regards

Amit Oberoi

Sent from my Nokia E72.
-----Original message-----
From: Maor Bril
Sent:  17/04/2011, 13:26 
To: log4j-user <at> logging.apache.org
Subject: NULL's in log
Hi All

Every once in a while I get a corrupted log file with a very long
sequence on NULL's where the text should be

This happens once in 3-4 days on sporadic occasions.

I use a static synchronized class for all the threads who want to write
to the log file access

This is due to the fact I need to output the message to a GUI screen as
well.

Both the methods and the actual access to the log are synchronized.

Example

(Continue reading)

Maor Bril | 17 Apr 10:13 2011

RE: NULL's in log

Thanks

Attached is my log4 config file



Maor Bril
SW  Engineer, QA Department
Allot Communications • a mind for networks™
Tel: +972 9 7619 263
Cell: +972 52 5600699
Fax: +972 9 744 3626
mbril <at> allot.com
www.allot.com




-----Original Message-----
From: Amit Oberoi [mailto:aoberoi <at> TechMahindra.com] 
Sent: Sunday, April 17, 2011 11:10 AM
To: log4j-user <at> logging.apache.org; Maor Bril
Subject: RE: NULL's in log

How does your Logger configuration looks like. I presume the problem is the way you are initiating/
declaring your Logger.

Regards

Amit Oberoi

(Continue reading)

Amit Oberoi | 17 Apr 15:42 2011

RE: NULL's in log

I couldn't find anything wrong with your configurations; if you can provide more information on the class
file implementing method logout(Object message) and the way you are instantiating your Logger object
may help.

Regards

Amit Oberoi 


-----Original Message-----
From: Maor Bril [mailto:mbril <at> allot.com] 
Sent: Sunday, April 17, 2011 1:43 PM
To: Amit Oberoi; log4j-user <at> logging.apache.org
Subject: RE: NULL's in log

Thanks

Attached is my log4 config file



Maor Bril
SW  Engineer, QA Department
Allot Communications • a mind for networks™
Tel: +972 9 7619 263
Cell: +972 52 5600699
Fax: +972 9 744 3626
mbril <at> allot.com
www.allot.com


(Continue reading)


Gmane