I'd like to set up an additional log file in symfony, so that some messages (payment processing in my case) would go to a different file from the rest of symfony. Is it possible?
Here's my current log configuration from factories.yml
:
all:
logger:
param:
level: debug
loggers:
sf_file_debug:
param:
level: notice
file: /var/log/symfony/%SF_ENVIRONMENT%/%SF_APP%.log
daviweb's solution will log messages to both log files,
new separate logger can be created using code:
$logPath = sfConfig::get('sf_log_dir').'/your-custom.log';
$custom_logger = new sfFileLogger(new sfEventDispatcher(), array('file' => $logPath));
$custom_logger->info("My log message!");
all:
logger:
class: sfAggregateLogger
param:
level: debug
loggers:
sf_file_debug:
class: sfFileLogger
param:
level: debug
file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log
sf_file_debug_additional:
class: sfFileLogger
param:
level: debug
file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%_additional.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With