Is there any way to group or sort my own "Craft::log()" calls for my Plugins?

It's a bit tedius to go through the Application->Logs each page load to try and find my own log messsages.

Maybe someone has a better approach to this?


Your plugin can keep its own log using MyPlugin::log('Message', LogLevel::Error);. A log method gets created automatically by extending BasePlugin. The plugin log will be located in craft/storage/runtime/logs/ along with the default logs.

As a side note: The log files can be watched from the command line using tail -F /full/path/to/log/file rather than having to constantly reload the log in a text editor. Although apparently some text editors also support live updates as well.

  • Is there a way to make the log message easier to "watch" in the JS console Application->Logs? I'm running the install on a live server and not locally so I don't have that direct access to the file to watch it all the time. Oct 10 '14 at 6:03
  • By using MyPlugin::Log() you will be able to use the search term MyPluginto filter messages, but it is still a pain to open the application>logs, etc. I would suggest using ssh and the tail -F method. It will likely save you time in the long run, and once running it's a continuous feed. No need to open or close anything! Keep in mind, not all log messages will go to the browser console either. If, for example, the process takes place on the server during a redirect operation. Oct 10 '14 at 12:39
  • Ok. I'll try that. Cheers :) Oct 10 '14 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.