If I was writing an app with an end user then I would do the following:

        1) Implement file - based logging so that I could use it for
debugging and troubleshooting purposes.

        2) I would not use log4j to provide feedback to the user but
would rather simply trap the error in the application level code.

        An example: Suppose someone tries to login and inputs an invalid
password.

        1) I would log an entry in the file that said "User X presented
invalid credentials".

        2) The validation class would return an error which I could test
for, and then I would print an error like: "Your username or password is
incorrect, please try again".

In your case you are assuming that every entry written to the log should
be shown to the user and in most cases this would not be the preferred
mode to use log4j in.

Cheers,
Philip.


-----Original Message-----
From: Slaughter, Stan [mailto:[EMAIL PROTECTED] 
Sent: December 13, 2005 3:02 PM
To: 'Log4J Users List'
Subject: RE: To Screen *NOT* to Console


It's common in applications which have an end user.  

JSP's are running in a web browser, so there is a need to tell the user
when an error occurs that prevents the page from loading or displaying
correctly.

I expect that: 

(a) Everyone simply resends the same message (or variation of it) to the
screen in a different way (ie out.print), essentially duplicating the
functionality of log4j in that sense.

Or

(b) Wrote their own ScreenAppender.

Or

(c) Sends back an error status and lets some other App worry about the
user.

Or

(d) "What's an end user?" - ie totally ignores the fact that the user is
left hanging, wondering what is going on.

How do you do it?

Application Architect
[EMAIL PROTECTED] 
Ext 6418

-----Original Message-----
From: Philip Denno [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 13, 2005 4:32 PM
To: Log4J Users List
Subject: RE: To Screen *NOT* to Console

Actually, I think that logging to the screen would *NOT* be a common
need. I use logging to a file because I have a large multi - threaded
application, and I use this information for tracability and debugging.
Much of this information would not be shown to the user (and would not
make much sense even if it was).

Log4j contains common appenders such as e-mail, connecting to syslog,
file based logging, DB logging, etc.. These appenders have been targeted
as common.

In your case you require non - common behaviour and so I think your only
option is to extend the framework with your requested behaviour.

Cheers,
Philip.

-----Original Message-----
From: Slaughter, Stan [mailto:[EMAIL PROTECTED] 
Sent: December 13, 2005 2:19 PM
To: 'Log4J Users List'
Subject: RE: To Screen *NOT* to Console


Thanks for the reply Phillip,

So, it sounds like log4j can not log to a screen unless you create your
own subclass of the ConsoleAppender.

Is it me, or does that not just sound weird?  Is there a reason why this
rather common need does not already exist in log4j as a ScreenAppender?

How do you other developers tell a user that an error occurred?  Have
you all essentially written your own ScreenAppenders?

Application Architect
[EMAIL PROTECTED] 
Ext 6418


-----Original Message-----
From: Philip Denno [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 13, 2005 4:00 PM
To: Log4J Users List
Subject: RE: To Screen *NOT* to Console

I assume that your application has a logger configured and is using the
console appender. If so then you need to create your own appender by
subclassing (look in the log4j javadoc for the correct class to use).

You would then update your config file to add your appender to the
logger. Any messages generated and sent to the logger would then go to
your custom appender as well as the console appender.

Cheers,
Philip. 


-----Original Message-----
From: Slaughter, Stan [mailto:[EMAIL PROTECTED] 
Sent: December 13, 2005 1:29 PM
To: 'Log4J Users List'
Subject: To Screen *NOT* to Console


What do I need to do to set up an Appender to log to the screen not the
console?

The equivalent of out.print in a JSP file instead of System.out.print

I need to let the user know when an error occurs and logging error
messages to a console does not do it.  I'd think a common task would be
to send messages to the screen, yet I can't find a Screen Appender. What
am I overlooking?

Does log4j-1.2.12 not support this?  Will I have to duplicate all my
error messages with an equivalent out.print statement?

Application Architect
[EMAIL PROTECTED] 
Ext 6418



-----------------------------------------
The information in this message may be proprietary and/or confidential,
and protected from disclosure.  If the reader of this message is not the
intended recipient, or an employee or agent responsible for delivering
this message to the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, please
notify First Data immediately by replying to this message and deleting
it from your computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to