jasmineRepo / JAS-mine-core

JAS-mine maintains and develops the JAS simulation platform, a discrete-event tool-kit for agent-based and dynamic microsimulation modelling. This repository contains the core libraries. See www.jas-mine.net for more details.
2 stars 5 forks source link

Migrate to log4j 2 #40

Open pbronka opened 9 months ago

pbronka commented 9 months ago

Issue: Currently used dependency log4j 1.2.17 has reached its end of life and is no longer officially supported.

Fix: Migrate to Apache Log4j™ 2

pbronka commented 9 months ago

Some extra information here: https://logging.apache.org/log4j/2.x/manual/migration.html

justin-ven commented 2 months ago

Would be nice if new logger reported all log output to a text file saved in a simulation run's output directory.

pbronka commented 2 months ago

While this issue refers to JAS-mine-core, it might be helpful to describe what is possible in some of the models using JAS-mine-core as the engine.

For example, SimPaths can save logged output (and console's output) in the output/logs directory when running in the MultiRun mode and this behaviour is requested by passing an -f flag. See Running SimPathsMultiRun with parameters

For example this command will save log output to a text file in in 'output/logs/run_[seed].txt' by default: java -jar multirun.jar -r 100 -p 50000 -n 20 -s 2017 -e 2020 -g false -f

Single run by default logs to src/main/resources/log4j/log.out, overwriting this file on each run.

Both could be directed to log to a different folder, by changing lines 176 onwards of this file for the MultiRun https://github.com/centreformicrosimulation/SimPaths/blob/742686f15c9b2065d3bb11329c1f57d1167d46af/src/main/java/simpaths/experiment/SimPathsMultiRun.java#L176

and line 1 of this file https://github.com/centreformicrosimulation/SimPaths/blob/742686f15c9b2065d3bb11329c1f57d1167d46af/src/main/resources/log4j.properties#L1 for the single run.