logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicholas Duane <nic...@msn.com>
Subject RE: global context properties
Date Sun, 20 Sep 2015 23:23:46 GMT
Thanks.  I assume you're talking about checking out the source for the RFC5424Layout, correct?
 I guess the source is easily accessible from somewhere?

I have a couple follow-up questions.

1. While using the method you suggest, could I also set system properties in the configuration
and get access to those from the layout object somehow?

2. What you suggest below using the PluginFactory @PluginConfiguration, does that allow you
to get the entire list of parameters without having to have a member property for each one?


> Subject: Re: global context properties
> From: ralph.goers@dslextreme.com
> Date: Sat, 19 Sep 2015 20:43:14 -0700
> To: log4j-user@logging.apache.org
> Take a look at RFC5424Layout. On the @PluginFactory method you will see a Configuration
parameters annotated with @PluginConfiguration. If you include this in your factory method
parameter list Log4j will automatically pass you the current Configuration object. From that
you can call the getProperties method to get the Map of the properties that we provided in
the configuration file.
> Ralph
> > On Sep 19, 2015, at 6:32 PM, Nicholas Duane <nickdu@msn.com> wrote:
> > 
> > We're using log4j to log business events.  Each application needs to specify some
application key/token.  I don't want to add this key/token to our API which creates the event
as that data is static for each application and thus should not have to appear in the API.
 I'm looking for some way to define this token/key somewhere, ideally configuration, and I
then need to be able to read it from a custom layout.  What would be the best way to do this?
> > 
> > I looked over the MDC and I don't think I need to store it there as this information
is global/static to the application.  I think you can define system properties within the
config but I'm not sure how to access those from a custom layout plugin.
> > 
> > Thanks
> > Nick
> > 		 	   		  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message