Answers.Body: <p>Craft has <code>Craft::log()</code> for that purpose. Brandon has an example of this function <a href="https://craftcms.stackexchange.com/q/253/177">over here</a></p>
  
  <p>To make this work from an external request, you can create plugin with a <a href="http://buildwithcraft.com/docs/plugins/controllers" rel="nofollow noreferrer">controller</a> which saves incoming data (post or json) to the log.</p>
  
  <p>To secure this with a key just send an additional variable and check if it's correct.
  Take a look at <a href="https://github.com/putyourlightson/Craft-Dump" rel="nofollow noreferrer">Ben's Dump</a> plugin, for an example of such a key-protected controller.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T17:30:04.050Z
Answers.Text: Ok, I see that writes the log file, and not the DB.
  
  Is there a way to write to a plugin-specific file, or does it always just go in the craft.log(.x) file?
Answers.UserDisplayName: Tim Kelty
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-25T17:35:59.143Z
Answers.Text: You can pass a plugin-handle as a log()-parameter, that way a separate log-file for your plugin will be created. (Brandon uses 'mypluginhandle' in his example) -- Otherwise if you want to save it to the DB, you could create a Record class which saves anything you want to the db.
Answers.UserDisplayName: Victor
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-24T17:32:40.787Z
Answers.LastActivityDate: 2014-06-24T17:32:40.787Z
Answers.LastEditDate: 2017-04-13T12:50:59.930Z
Answers.UserDisplayName: Victor
Body: <p>Problem:
  I want to be able to log things to my Craft DB from an external app, via some sort of request.</p>
  
  <p>So my first question is, is there any plans for any kind of built-in development log, or should use something like: <a href="https://github.com/themusicman/lumberjack/" rel="nofollow">https://github.com/themusicman/lumberjack/</a></p>
  
  <p>Second, I'd have to set up some kind of shared key authentication so I could post to this log with an external request.</p>
  
  <p>What tools does Craft/Yii already have for this process, and what would need to be custom development?</p>
  
Tags: <plugin-development><database>
Title: Native development log / API access?
ThreadText: # Native development log / API access?
  
  (Asked by: username_0 on 2014-06-24)
  
  Problem:
  I want to be able to log things to my Craft DB from an external app, via some sort of request.
  
  So my first question is, is there any plans for any kind of built-in development log, or should use something like: <https://github.com/themusicman/lumberjack/>
  
  Second, I'd have to set up some kind of shared key authentication so I could post to this log with an external request.
  
  What tools does Craft/Yii already have for this process, and what would need to be custom development?
  
  **Tags:** plugin-development, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-06-24. Score: 3 | Accepted answer
  
  Craft has `Craft::log()` for that purpose. Brandon has an example of this function [over here](https://craftcms.stackexchange.com/q/253/177)
  
  To make this work from an external request, you can create plugin with a [controller](http://buildwithcraft.com/docs/plugins/controllers) which saves incoming data (post or json) to the log.
  
  To secure this with a key just send an additional variable and check if it's correct.
  Take a look at [Ben's Dump](https://github.com/putyourlightson/Craft-Dump) plugin, for an example of such a key-protected controller.
  
  > **Comments:**
  > **username_0**: Ok, I see that writes the log file, and not the DB.  Is there a way to write to a plugin-specific file, or does it always just go in the craft.log(.x) file?  
  > **username_1**: You can pass a plugin-handle as a log()-parameter, that way a separate log-file for your plugin will be created. (Brandon uses 'mypluginhandle' in his example) -- Otherwise if you want to save it to the DB, you could create a Record class which saves anything you want to the db.  
  
  ---
  
  