FrankChen021 commented on pull request #10147:
URL: https://github.com/apache/druid/pull/10147#issuecomment-991537653


   @clintropolis the problem is that middle manager redirects the output of a 
task into a task log file, so for tasks, they must output the log to the 
console. Since peon tasks also can find the `log4j2.xml` under the `_common` 
directory, and they derivate system properties from the parent process (middle 
manager), so all logs are written the log middle manager's log.
   
   
   There're two alternatives for us:
   1. put another log4j2 configuration file, say `log4j2_task.xml`, which 
contains the console appender configuration, under the _common directory, and 
we put `-Dlog4j2.configurationFile=log4j2_task.xml` to 
`druid.indexer.runner.javaOpts` property.
   
       For this alternative, users can still edit the log4j2_task.xml or delete 
the required argument from `druid.indexer.runner.javaOpts`, which will lead to 
the failure of task log mechanism.
   
   2. Implements a customer log4j2 `ConfigurationFactory` class in the task 
module, this class override the default configuration from the `log4j2.xml`, 
and override the appenders to ConsoleAppender. Also, middle manager should pass 
a `-Dlog4j2.configurationFactory=THIS_CUSTOMER_CLASS_NAME` to the task process.
   
       For this alternative, it forces the peon tasks to use a console log 
appender even if the user provides a wrong configuration file. 
   
   I prefer the latter one, because it's more reliable that users can't break 
the task log mechanism.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to