|
From: Leif M. <le...@ta...> - 2004-02-17 00:21:39
|
Alex,
The Wrapper is designed to log everything that is sent to the
console by the JVM
along with any and all logging information from the Wrapper process
itself. Normally
information sent to the console would simply be lost when running as a
service as a
service does not have a console.
If your application did not have a logging system, other than using
the console, then
the Wrapper can be a handy fall back logging system. But that is really
not what it
is designed for. Most applications should be using their own logging
system within the
JVM. That logging system can be used to control what is logged at any
time as well
as where the individual log messages are sent. Personally I have found
that the most
useful thing to do is to have two log targets.
One to the console which is designed for user consumption. This
all ends up in
the Wrapper.log file.
The second goes to a file for developer / sys admin use. It
contains much the
same information as the first log file except that the messages also
include any related
stack traces. Things that are useful for debugging problems but would
freak out
the idle user.
While logging systems build within a Java application are very
powerful. There are
some things that they are not capable of doing. One is to log low
level console
output from the JVM. This include thread dump output and core dump
information
when the JVM process crashes. The Wrapper is capable of capturing and
logging
both. But it this is because it is done outside of Java in the native
Wrapper process.
As for intercepting the System.err and System.out messages. That
is entirely
possible. But you will only be redirecting the information within the
JVM that was
sent to either stream. This does not include the low level JVM output
mentioned
above, or any messages that originate from the Wrapper process itself.
These
will still end up in the wrapper.log file. This is actually what you
want. Remember
that the Wrapper process is running before the JVM and thus your logging
code is
started. It is also running after it is shutdown. The Wrapper will
also still be running
if your JVM crashes, hangs, etc. In other words, the Wrapper's logging
mechanism
works in several circumstances where any Java based logging system will not
function.
In version 3.0.5 of the Wrapper, intercepting System.out will also
redirect all
output generated by the java component of the Wrapper. This has been
changed
for a number of reasons in 3.1.0. Starting in the next release, such
output is
always sent to the original System.out, ie. the console, even if
System.out is
redirected for the rest of the application. This should not affect user
applications
in any way. It does improve the reliability of the Wrapper in cases
where the user
logging system is buggy, and helps with debugging the Wrapper by keeping
all of
its output together in the wrapper.log file.
I'm glad you are finding the Wrapper useful.
Let me know if you have any more questions.
Cheers,
Leif
Alex V. wrote:
>Hi All,
>
>My application is using its own logging component, built as a jdk1.4 style
>log handler (@see jdk1.4 logging APIs). Thus, when I run as an NT service
>using the (really cool I must say) wrapper, I end-up with two different log
>systems.
>
>I was wondering if there was a way to intercept/redirect all messages logged
>by the wrapper, including the System.out and System.err. If not, would
>support for jdk1.4 logging APIs be considered a legitimate enhancement
>request?
>
>Also, if I redirect the System.err and System.out in my listener, am I going
>to intercept all messages logged by the wrapper?
>
>Rgrds, Alex.
>
>PS: Thanks for the 'set.PATH' hint; works jut fine for me.
>
>
|