Hi,
By the way, I'm just suggesting this approach as an alternative with
less work compared to your original idea. Your original design is also
fine and workable, but I like to suggest an alternative that will keep
you within the log4j framework.
Yoav Shapira
Millennium Research Informatics
>-----Original Message-----
>From: Shapira, Yoav
>Sent: Friday, September 03, 2004 9:07 AM
>To: Log4J Users List
>Subject: RE: New logging method
>
>
>Hi,
>You specify the ObjectRenderer in the configuration file, as
>log4j.renderer.fully.qualified.name.of.rendered.class=fully.qualified.n
a
>me.of.rendering.class. See the PropertyConfigurator class JavaDoc for
a
>bit more details.
>
>The Map would get passed using the normal logging calls, e.g.
>Map stuff = new HashMap();
>stuff.put("principal", myPrincipal);
>stuff.put("subject", mySubject);
>stuff.put("message", myMessage);
>logger.info(stuff);
>
>Cases like these are one of the main reasons methods like
>logger.info/warn/debug/error/fatal take Object and not String.
>
>Yoav Shapira
>Millennium Research Informatics
>
>
>>-----Original Message-----
>>From: Seaman, Sloan [mailto:[EMAIL PROTECTED]
>>Sent: Friday, September 03, 2004 8:57 AM
>>To: 'Log4J Users List'
>>Subject: RE: New logging method
>>
>>Yoav,
>>
>>How would the map get passed and where do I specify the ObjectRenderer
>to
>>use?
>>
>>Do you know of an example?
>>
>>Thanks!
>>
>>--
>>Sloan
>>
>>-----Original Message-----
>>From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
>>Sent: Friday, September 03, 2004 8:54 AM
>>To: Log4J Users List
>>Subject: RE: New logging method
>>
>>
>>
>>Hi,
>>You could use a normal JDBCLogger, pass it a Map (or other Collection
>of
>>your choice) that contains the subject, principal, and a message, and
>write
>>an ObjectRenderer that can render those classes. That way you don't
>need a
>>custom logger or a custom appender.
>>
>>Yoav Shapira
>>Millennium Research Informatics
>>
>>
>>>-----Original Message-----
>>>From: Seaman, Sloan [mailto:[EMAIL PROTECTED]
>>>Sent: Friday, September 03, 2004 8:13 AM
>>>To: '[EMAIL PROTECTED]'
>>>Subject: New logging method
>>>
>>>I'm trying to figure out the best way to implement an audit system
for
>>my
>>>companies apps and I was thinking about using Log4j's framework but
>I'm
>>not
>>>sure of the best way of doing it.
>>>
>>>I need to be able to do something like:
>>>log.audit(javax.security.auth.Subject subject, Class principalClass,
>>String
>>>msg);
>>>
>>>So I was thinking I would have to create my own Logger, such as:
>>>AuditLogger log = AuditLogger.getLogger(classname);
>>>
>>>And then use the JDBC Appender to write the audit information to the
>>>database.
>>>
>>>Now, I figure I have to create a new new patternlayout character
(such
>>as
>>>%s
>>>for subject) so that I can use all the different appenders easily...
>>>
>>>But I'm curious about the best way to get the log.audit() to work
with
>>the
>>>existing framework.
>>>
>>>Can anyone point me in the right direction? Should I do it this way
>or
>>do
>>>something like:
>>>log.setSubject();
>>>log.setPrincipalClass();
>>>log.debug(msg); // have different audit levels...
>>>
>>>Thanks!
>>>--
>>>Sloan
>>>
>>
>>
>>
>>
>>This e-mail, including any attachments, is a confidential business
>>communication, and may contain information that is confidential,
>>proprietary
>>and/or privileged. This e-mail is intended only for the individual(s)
>to
>>whom it is addressed, and may not be saved, copied, printed, disclosed
>or
>>used by anyone else. If you are not the(an) intended recipient,
please
>>immediately delete this e-mail from your computer system and notify
the
>>sender. Thank you.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>This e-mail, including any attachments, is a confidential business
>communication, and may contain information that is confidential,
>proprietary and/or privileged. This e-mail is intended only for the
>individual(s) to whom it is addressed, and may not be saved, copied,
>printed, disclosed or used by anyone else. If you are not the(an)
intended
>recipient, please immediately delete this e-mail from your computer
system
>and notify the sender. Thank you.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged. This
e-mail is intended only for the individual(s) to whom it is addressed, and may not be
saved, copied, printed, disclosed or used by anyone else. If you are not the(an)
intended recipient, please immediately delete this e-mail from your computer system
and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]