Questions tagged [monolog]

Monolog is a logging library for PHP 5.3 used by Symfony2. It is inspired by the Python LogBook library.

514 questions
1
vote
1 answer

Is php monolog wrap line when write message to log?

I have a piece of code. class LogApi { private $log; private $path; private $format = array( 'date' => 'Y-m-d H:i:s', 'message' => '[%datetime%][%channel%][%level_name%] : %message% %context%', ); private…
diligent
  • 2,282
  • 8
  • 49
  • 64
1
vote
1 answer

Logging messages to Redis with monolog is not working

I want to log messages to a local Redis server with Monolog in a Symfony 2 project. I'm using the SncRedisBundle for this purpose. This should be straight forward following the documentation, but it seems that no messages are stored in Redis. If I…
tom
  • 8,189
  • 12
  • 51
  • 70
1
vote
1 answer

Strange error: "Couldn't find constant Logger::DEBUG" when using Monolog in Laravel

I've got a simple class that allows me to write to any log file: use Monolog\Logger; use Monolog\Handler\StreamHandler; class Mylog { public function __construct($log, $level = 'debug') { $this->monolog = new Logger($log); $level…
timetofly
  • 2,957
  • 6
  • 36
  • 76
1
vote
1 answer

Symfony2 Monolog to channel in controller

I've configured a seperate channel for some messages according to the cookbook: special: type: stream path: %kernel.logs_dir%/special.log channels: ["special"] And getting a service to log to that is easy. But I also…
Tom
  • 2,688
  • 3
  • 29
  • 53
1
vote
2 answers

How to log messages to different files with Monolog in Symfony2.2?

I would like to use Monolog in symfony2 application for logging, but my question is how can I split the file every day instead of appending to the same file? I would like my log file to be somthing like…
1
vote
1 answer

Symfony2, Is there any way to use Monolog to split the log files every day?

I would like to use Monolog in symfony2 application for logging, but my question is how can I split the file every day instead of appending to the same file? I would like my log file to be somthing like…
pmoubed
  • 3,842
  • 10
  • 37
  • 60
1
vote
2 answers

Symfony2: Logging 1. own Channel 2. in own File (in dev)

Sorry for this Thread, but I really can't figure out, how to configure Symfony2 to do what I like it to do :-) I just don't get the 'big picture'. I would like to create an own log-channel for some central things my bundle. This Channel should…
Sammy
  • 1,178
  • 1
  • 14
  • 27
1
vote
2 answers

Symfony2: Problems using logger in a service (passed as as parameter)

I'm developing a project using Symfony 2.1. I have created a service that is being called from a controller, and it's working ok. Now I need that the service generates log, and I'm trying to pass logger this way: soap.client: class:…
DaveFX
  • 407
  • 1
  • 8
  • 16
1
vote
1 answer

Monolog is not starting on production settings under symfony2

When running application with production settings and debug disabled monolog does not start. With enabled debugging it starts as usual. With development settings it starts regardless of debug options. How to force monolog running on production…
S3Mi
  • 491
  • 4
  • 10
1
vote
1 answer

Preventing my Logger to flood me with messages

I've built in a Logger (Monolog) in my PHP project that is configured to log system events (info/debug) but also errors (error/critical) I've set it up so that when a critical error occurs 2 systems are called, one sends a mail and the other sends…
ChrisR
  • 14,370
  • 16
  • 70
  • 107
1
vote
2 answers

Symfony2 is not logging exceptions thrown inside custom command

When an error occurs during a normal http request, Symfony2 logs everything (depending on your logging level) and you can see it in dev.log or app.log. But when you get an error during the execution of a custom command, it doesn't log anything. It…
ChocoDeveloper
  • 14,160
  • 26
  • 79
  • 117
1
vote
1 answer

Custom logger and monolog formatter in symfony2 - configure services.xml

I have started learning Symfony2 and currently I am dealing with a command that I want to log separately. My goal is to use a custom logger and get a clean log file for my command. I work on a project that uses xml configuration files but I don't…
andrespd
  • 13
  • 1
  • 4
0
votes
2 answers

Set %level_name%: field width in \Monolog\Formatter\LineFormatter (PHP)

I am using the Monolog LineFormatter as follows: $output = "[%datetime%] %level_name% %channel%: %message%\n"; $stream_handler->setFormatter(new LineFormatter($output)); This results in the following log lines: [2023-07-03T05:30:31.327443+02:00]…
Valon
  • 1
  • 1
0
votes
0 answers

Trying to extend Laravel 10's loggin with custom functions

I want to be able to do the following statement Log::channel('database')->category('asdasd')->info('This will be logged to the database.'); and I have it so that it inserts the message to the logs table if I take out the ->category() part of it. I…
ODelibalta
  • 2,194
  • 1
  • 18
  • 28
0
votes
0 answers

On Symfony, how to configure an application package on a bundle?

I'm failing miserable on something that I think should be possible. I have 2 Symfony applications that have a set of bundles both use. One of these is a log bundle with some interfaces and messagehandlers. I use symfony/monolog on both…
Yohan Leafheart
  • 860
  • 1
  • 11
  • 27