-
Notifications
You must be signed in to change notification settings - Fork 1
Logging
In the Dul-Hydra project, the default Ruby/Rails logging framework has been replaced with Log4r. This involved installation of the log4r gem, construction of a log4r yaml configuration file (config/log4r.yml), and editing of the config/application.rb file to assign log4r's logger as the Rails' logger.
At the current time, Rails' logging (using log4r) is set to mimic the default Rails' logging, which is to log to a file in the log/ directory using a filename based on the environment (e.g., 'development' or 'test'). One difference from the default Rails' logging configuration is that these log files are now date-stamped so that a new one is created each day.
Rails' logging can be used by calling logger methods (e.g., debug, info, warn, error) on the logger
object which Rails makes available. For example, adding logger.info("my log message")
to an application model, controller, etc., will result in a log entry in either the development or test log for that day, depending on the environment in which the code is run.
In addition to the "standard" environment-oriented loggers available via the Rails' logger
object, it is possible to create and use additional loggers as desired. For example, the batch ingest process is being modified to log to separate log files, which are configured in config/log4r_batch_ingest.yml.
At the same time (though unrelated to the switch to log4r), I also turned off the "colorizing" of logging to get rid of the color escape codes being written to the log files with certain messages. This was done by adding the config.colorize_logging = false
line in config/application.rb.