logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deacon Marcus" <deacon_mar...@wwtech.pl>
Subject RE: Getting a good user experience on Windows?
Date Sat, 05 Jan 2002 09:14:05 GMT

> -----Original Message-----
> From: Bob Jacobsen [mailto:Bob_Jacobsen@lbl.gov]
> Sent: Saturday, January 05, 2002 6:34 AM
> To: Log4J Users List
> Subject: Getting a good user experience on Windows?
> I've been using Log4J on a Linux/Macintosh project for a while, with
> much success.  But I've started to get some Windows users (esp.
> Win98, which seems to be quite popular among my hobbyist users), and
> they're not happy.
> I'd like some advice on how to solve two problems.
> I'm using a ConsoleAppender and a FileAppender, generally configured as:
>    log4j.appender.A1=org.apache.log4j.ConsoleAppender
>    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>    log4j.appender.A1.layout.ConversionPattern=%6r %-37.37c{2}
> %-5p - %m [%t]%n
>    log4j.appender.R=org.apache.log4j.FileAppender
>    log4j.appender.R.File=example.log
>    log4j.appender.R.layout=org.apache.log4j.PatternLayout
>    log4j.appender.R.layout.ConversionPattern=%6r %-37.37c{2} %-5p
> - %m [%t]%n
> There's no other configuration information defined; I'm really hoping
> that somebody will tell me the magic words to fix two problems:
> a) Seeing the ConsoleAppender.
> On the Mac and Linux, standard output is conveniently available in a
> window.  On Windows, when you start the application by clicking on
> the .jar file, the logging standard output doesn't seem to go
> anywhere; I certainly haven't found it.  The only way I've seen to
> get the ConsoleAppender output is to open a DOS window and run from
> the DOS prompt.  But this really isn't a good user experience, to say
> the least.
> Does anybody know a better way to handle this on Win95/98 etc?

Basically you need to substitute javaw.exe with java.exe. The difference is,
practically, that java.exe gives you dos-like window while javaw.exe runs
Fix: open regedit.exe, check HKEY_CLASSES_ROOT/.jar - it should have a
"(default)" value "jarfile". Check HKEY_CLASSES_ROOT/jarfile - it should
have something like /shell/open/command/ "(default" = "C:\Program
Files\JavaSoft\JRE\1.4\bin\javaw.exe -jar %1" - change to "C:\Program
Files\JavaSoft\JRE\1.4\bin\java.exe -jar %1". You can now select
HKEY_CLASSES_ROOT/jarfile in the tree panel and tell it to "export"
"selected branch" "HKEY_CLASSES_ROOT\jarfile\" to a file - you can now give
that file to your users to install on their machines (double click on .reg
file is enough), if they have the same version (I believe the setting looks
the same for versions 1.2-1.4, so you can manually edit the .reg file to
create 1.2, 1.3, 1.4 versions).

> b) The FileAppender creates files that are inconvenient to look at.
> Apparently, the most common way to look at a text file on Windows is
> with the Notepad application, and it insists that line should end
> with _both_ a CR (0x0D) and LF (0x0A) character!!  It certainly
> possible to open with files with a source-file editor, but not
> everybody has one.  As configured, Log4J's FileAppender puts only the
> LF on Win95/98.  This is really Not A Problem on Linux or the
> Macintosh, but again is a real hassle for users.

WordPad is perfectly ok with unix line endings. Just change the assignation
from .log (or whatever) -> notepad.exe to .log -> wordpad.exe. You can use
"folder options" from explorer or registry again. If you go for registry,
you need to change "HKEY_CLASSES_ROOT\txtfile\shell\open\command"
"(default)" from "C:\WINDOWS\NOTEPAD.EXE %1" to "C:\WINDOWS\WORDPAD.EXE %1",
just "WORDPAD.EXE %1" should work also. Same for
"HKEY_CLASSES_ROOT\txtfile\shell\print\command" "(default)" from
"WORDPAD.EXE /p %1" (not sure if it'll work with right-click printing).
Again, you can just export the .reg file and tell your users to install it.

Both are quick-fixes from my 98 SE machine, it could be different on
different kinds of Win32 (I'm not sure how about NT-line - 95 line have it
as above from 95 to ME).

> Can anybody suggest solutions to these? Preferably cross-platform ones?
> Thanks in advance.
> Bob
> --
> --------------
> Bob Jacobsen (Bob_Jacobsen@lbl.gov, 510-486-7355, fax 510-495-2957)

Hope this helps, greetings,
     deacon Marcus

HELP STARVING JAVA PROGRAMMER: If you need cheap and reliable JSP hosting,
please contact deacon_marcus@wwtech.pl (from 12$/m for 50mb WWW + 20mb mail)

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message