Major
Detail
Major
Detail
Detail
#27019
Inconsistent logging: scheduler uses its own log file, but its tasks do not
The scheduler has its own log file. However, this is not used by tasks. This is exactly the same area in the code. Both should therefore log to the same files.
The reason is a too special pattern in the log configuration. Only exactly the class tl:Scheduler is redirected to the special file. Instead, the whole package should be redirected.
Conversion
The pattern was changed to the package com.top_logic.util.sched. This way this package and its "inner" packages use the scheduler log.
However, the individual tl:Task and tl:Batch implementations were not redirected there. The overhead for this is too high: Log4j does not provide a way to filter classes by their supertypes. This would have to be implemented by yourself.
Also it was not changed that warnings and errors are written by the scheduler only to its own log. So they are still not written to the main application log. Also for this the effort would be too large due to restrictions of Log4j, because this would have to be implemented.
Code Migration
Own log configurations must be adapted in the same way, if the scheduler writes there also into an own log file:
- In all log configurations search for: <Logger name="com.top_logic.util.sched.Scheduler"
- Replace everywhere with: <Logger name="com.top_logic.util.sched"
Test
- Before starting the demo, delete the old log files there.(com.top_logic.demo/tmp/app-data/logs)
- Run tasks in the demo.
- In the file top-logic.main.log no entries from the package com.top_logic.util.sched may appear.
- In the file top-logic.sched uler.log entries from com.top_logic.util.sched.task.log.TaskLogCommon and com.top_logic.util.sched.Scheduler must appear.