08.
Logging and Adding other Tools
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
5 Comments
Hello,
I want to use a Monolog but I want to throw logs with http request to my server. Is this possible? Because i take logs with http request and i make another actions on my server.
Hey Mert Simsek!
I don't think I understand your question. What do you mean by "throw logs with http request to my server"? Do you mean that you want to store the logs somewhere on your server? Or do you want to include http request information in the log message? Or something different?
Cheers!
I want to create a log when send an http request this log to my server. I didnt use guzzle for send this log because i want to use monolog class. So i create a instance (new Monolog) and set a log; after this log go to my server. is this possible?
Hey Mert,
Probably, the main questions is your application runs on the same server where you want to send logs? If on the same server, then you just need to add a new stream handler and write directly to the file system. You can specify where exactly write those logs with "path" option - see "Writing Logs to different Locations" section in docs: https://symfony.com/doc/cur... .
But, if your application runs on a different server of that where you want to send your logs - then you have a few options:
1. You can send API requests with Guzzle or similar to that server and handle those requests with another one application. - probably not something you want as I see from your message
2. Or, I think you can write a custom Monolog handler, so Monolog will collect all your logs and send them to another server with Guzzle or similar. For example, take a look at Loggly handler, it also sends logs with HTTP requests but using Monolog\Handler\Curl\Util helper instead of Guzzle: https://github.com/Seldaek/...
Does it something you asking? But anyway, if we're talking about different servers, it should be a kind of HTTP request to implement interaction between them I think, but I could be wrong.
Cheers!
Then I start the second option. This message helped, thank you :)
"Houston: no signs of life"
Start the conversation!