Answers.Body: <p>You can do this in your plugin:</p>
  
  <pre><code>ExamplePlugin::log('the is the log message');
  </code></pre>
  
  <p>the log method has the following signature:</p>
  
  <pre><code>log($msg, $level = LogLevel::Info, $force = false)
  </code></pre>
  
  <p>documentation <a href="https://docs.craftcms.com/api/v2/craft-baseplugin.html#public-properties" rel="nofollow noreferrer">is here</a></p>
  
  <p>your log will appear in the app/storage/runtime/logs/pluginname.log</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-03T12:05:03.087Z
Answers.Text: Do i have to create any class for this to work?
Answers.UserDisplayName: mbalparda
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-03T12:07:02.030Z
Answers.Text: if you have a custom plugin your will already have a main plugin class in the root of your plugin folder like ExamplePlugin.php this class will extend BasePlugin and thus get the static log function
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-10-03T12:01:58.670Z
Answers.LastActivityDate: 2018-09-20T21:24:44.713Z
Answers.LastEditDate: 2018-09-20T21:24:44.713Z
Answers.UserDisplayName: Luke Holder
Body: <p>Is there any way to create a custom log in Craft? I need to log some actions inside a controller/service in a custom plugin.</p>
  
Tags: <plugin-development>
Title: Custom Log in Craft
ThreadText: # Custom Log in Craft
  
  (Asked by: username_0 on 2014-10-03)
  
  Is there any way to create a custom log in Craft? I need to log some actions inside a controller/service in a custom plugin.
  
  **Tags:** plugin-development
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-03. Score: 14 | Accepted answer
  
  You can do this in your plugin:
  
  ```
  ExamplePlugin::log('the is the log message');
  
  ```
  
  the log method has the following signature:
  
  ```
  log($msg, $level = LogLevel::Info, $force = false)
  
  ```
  
  documentation [is here](https://docs.craftcms.com/api/v2/craft-baseplugin.html#public-properties)
  
  your log will appear in the app/storage/runtime/logs/pluginname.log
  
  > **Comments:**
  > **username_0**: Do i have to create any class for this to work?  
  > **username_1**: if you have a custom plugin your will already have a main plugin class in the root of your plugin folder like ExamplePlugin.php this class will extend BasePlugin and thus get the static log function  
  
  ---
  
  