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 <[email protected]> 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: [email protected] For additional commands, e-mail: [email protected]
