[ 
https://issues.apache.org/jira/browse/LOG4J2-3586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17599285#comment-17599285
 ] 

Deepak Pareek commented on LOG4J2-3586:
---------------------------------------

Hello [~mattsicker] ,
We have already explored these property substitution and lookups. Doesn't help 
much.

[~rgoers]  Please find the requested details below : 

+We have defined appenders in Log4j.XML in this way :+

_<appender class="xxx.xxx.log4j.CustomAppender" name="CnxAppender">_
    _<param name="AppName" value="appName"/>_
    _<param name="GridNames" value="gridName"/>_
    _<layout class="org.apache.log4j.PatternLayout">_
      _<param name="ConversionPattern" value="%-5p [%t] %x %C#%M - %m%n"/>_
    _</layout>_
_</appender>_

_<logger additivity="false" name="xxx.xxx.package">_
   _<level value="ERROR"/>_
   _<appender-ref ref="CnxAppender"/>_
_</logger>_
  
*CustomAppender architecture :* This is our custom appender which extends 
Log4j1.x AppenderSkeleton and have methods like 
activateOptions(),setLayout(),getName(),setName(String name) etc.

*appName  :* App name will be depending upon the app for which we are are 
defining appender.
We create logfiles for apps using these app names only. 
Corresponding to the each appName, we can select trace levels which are then 
provided to the custom appender.

*gridName :* We have gridInfo.xml file in place, which will be having detailed 
logging configuration to get mapped with log4j.xml.
So these grids are responsible for generating logs for multiple packages 
defined in gridInfo.xml file.

+Sample structure of a grid in _gridInfo.xml_ :+

_<DiagnosticGrid name="gridName" text="grid for xyz web app">_
        _<DiagnosticLevels>_
            _<DiagnosticLevel level="0" dpLevel="0" text="Errors and Fatal 
events" default="true" alwaysOn="true">_
                _<log4j  categories="xxx.xxx.package" enableLevel="ERROR" 
disableLevel="ERROR"/>_
            _</DiagnosticLevel>_
            _<DiagnosticLevel level="2" dpLevel="2" text="Data Access (High)">_
                _<log4j  categories="xxx.xxx.package.batch 
xxx.xxx.package.async xxx.xxx.package.bo xxx.xxx.package.mla" 
enableLevel="DEBUG" disableLevel="ERROR"/>_
            _</DiagnosticLevel>_
            _<DiagnosticLevel level="3" dpLevel="3" text="Data Access (Low)">_
                _<log4j  categories="xxx.xxx.package.dao" enableLevel="DEBUG" 
disableLevel="ERROR"/>_
            _</DiagnosticLevel>_
        _</DiagnosticLevels>_
_</DiagnosticGrid>_

*We want to understand if there is similar kind of implementation in Log4j2.*
*Let us know if any other details are required.*
Thanks,
Deepak Pareek

> AppenderSkeleton substitute in Log4j2.17.
> -----------------------------------------
>
>                 Key: LOG4J2-3586
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3586
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.17.2
>            Reporter: Deepak Pareek
>            Priority: Major
>              Labels: features
>
> Hello Team,
> We are using log4j 1.x in our project, it has custom appender for logging 
> which leverages org.apache.log4j.AppenderSkeleton.
> It uses Grid name and App name mapping for dumping app specific logs.
> We have to upgrade log4j version to Log4j2. Hence we are looking for 
> AppenderSkeleton substitute, which uses the same underlying architecture. We 
> have already explored the available customized appender options [using 
> @Plugin], but that is not feasible for us as our core framework is designed 
> in such a way that we need to provide App name and Grid name in log4j.xml 
> itself.
> So to summarize we are looking forward for help on below points : 
> 1. Is there any way to add app name and grid name in Log4j2.xml ? 
> 2. Is the any AppenderSkeleton substitute, which uses the same underlying 
> architecture ?
> Any help on the above mentioned points will be highly appreciated.
>  
> Thanks,
> Deepak Pareek



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to