Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with my three questions #1813

Open
AC-Lover opened this issue Jun 16, 2023 · 3 comments
Open

Help with my three questions #1813

AC-Lover opened this issue Jun 16, 2023 · 3 comments
Labels

Comments

@AC-Lover
Copy link

AC-Lover commented Jun 16, 2023

Monolog version 3.3.1

$log->pushHandler(new StreamHandler(__DIR__.'/Warning.log', Level::Warning));
$log->pushHandler(new StreamHandler(__DIR__.'/Error.log', Level::Error));
$log->pushHandler(new StreamHandler(__DIR__.'/Debug.log', Level::Debug));
$log->pushHandler(new StreamHandler(__DIR__.'/Info.log', Level::Info));

Hello

  1. I want when $log->error(); I used it, so that the log is only saved in Error.log, what should I do?
  2. And that I want it to be printed in the terminal at the same time
  3. How to clear the log files? Or limit it and delete it automatically
@AC-Lover AC-Lover changed the title Help with my two questions Help with my three questions Jun 16, 2023
@Seldaek
Copy link
Owner

Seldaek commented Jun 20, 2023

  1. Use a FilterHandler to select a single level, and put the StreamHandler inside it
  2. Add another StreamHandler with php://stdout as stream
  3. The best is to use logrotate, but we do have RotatingFileHandler as well for basic purposes

@rainerzufall081572
Copy link

Hello @Seldaek , what exactly is meant by "use logrotate" in this context? is logrotate another product/tool/library that can be used with monolog? or some part/configuration/setting of monolog? thank you :)

@Seldaek
Copy link
Owner

Seldaek commented Jul 10, 2023

Here is more info about logrotate https://docs.rackspace.com/support/how-to/understanding-logrotate-utility/ - it's a log rotating utility which is present by default on most linux systems (AFAIK).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants