10
votes
Accepted
Craft 3 plugins - Logging in a separate *.log file
Edit 2
I came up with a far far far better approach after a little brainstorming. I'll keep my old answer here but you should probably just use the first snipped.
In your main Pluginfile.php
public ...
9
votes
Craft 3 plugins - Logging in a separate *.log file
Another perhaps simpler approach is to write to your own log file without using the Craft logger at all.
$file = Craft::getAlias('@storage/logs/pluginhandle.log');
$log = date('Y-m-d H:i:s').' '.$...
5
votes
Accepted
Craft CMS 3.0 - Log file?
Based on the official documentation the log files are under /storage/logs and look for the web.log file especially.
If you don't find anything check your webserver logs.
3
votes
Is it possible to stop Craft from logging so much?
As someone who theoretically might inherit your site one day... and also as future-you trying to diagnose a problem... please don't try to limit what Craft logs. If you want a quicker way to look for ...
3
votes
wp-login.php bloating log files every 20-30 seconds
So what I do is I just redirect anything requesting a WordPress-ish thing to WordPress.com (that's what they are looking for, after all...). You can see how to do that here if you're using Nginx:
...
3
votes
See 404 error cause by some weird URI in index.php
These are very likely bots that are scanning the website for various things (I see it for WordPress logins a ton). Two things you can do:
Redirect them. This is what I do for WordPress bots
Install ...
3
votes
GeneratePendingTransforms stuck every time
I think to solve your issue we're going to need a bit more of information. A couple of things you can try:
set a higher max execution time. I think normally the max execution time is 120 sec. and ...
2
votes
Constant exception.Craft\HttpException.404 in logs
You can try installing the Retour plugin to get a log of all of the 404 errors and their referrers, and potentially handle them via redirects.
2
votes
Unknown error in users section, after importing sql dump. Need help understanding logs
It seems to be failing because of the date time '-0001-11-30 00:00:00', which doesn't look like a proper date to me.
Did you do the database dump via the Craft CMS control Panel (CP), or did you ...
2
votes
GeneratePendingTransforms stuck every time
I'd suggest reading over the Stuck Tasks support article. It has general debugging tips for all tasks for figuring out why they get stuck and more specifically debugging tips for the Generate Pending ...
2
votes
Craft 3 plugins - Logging in a separate *.log file
Adding this for posterity, for any future-traveller who happens to come along.
Here's everything you need to know about making a custom logger for Craft CMS:
Creating a Custom Logger for Craft CMS
...
2
votes
Craft CMS 3.0 - Log file?
If you want to view the logs in the control panel in Craft 3, like was possible in Craft 2, then you will need to use this plugin: Logs
2
votes
Can I find log activity of who deleted a user and who edited an entry?
This Activity Logs plugin records the more low-level HTTP requests, but with all of Craft's additional info, such as Action, User, Site, CP vs Site, Ajax vs Page, etc.
The user has full control over ...
2
votes
Is it possible to stop Craft from logging so much?
This will be a similar answer as here: Craft 3 large log file sizes
Basically Craft goes with Yii's default FileTarget settings, which is 5 log files of 10MB each before they start rotating out. ...
2
votes
Accepted
Custom plugin log not logging
Put the force parameter to true
MyPlugin::log("Errors:\n\n" . print_r($fieldsData, true), LogLevel::Error, true);
Custom Log in Craft
2
votes
Plugin logging not appearing
At first, I didn't internalize the substance of the log message, and assumed the logger was filtering out your statement due to the target's configured "levels."
However, considering that ...
1
vote
Integrity constraint violation blocks queue
This could maybe help you track down the issue:
The search index table has all of its rows removed and re-built any time an element is saved. You could look at the timestamp of the error and look for ...
1
vote
Database not backed up because the backup command is false
Try to check you config/general.php if you found this, try to set to true or remove it.
'backupCommand' => false,
1
vote
Custom log file from module/controller
You can do this with the Log To File helper, which provides a simple way for logging messages to a specific file: https://github.com/putyourlightson/craft-log-to-file
This question has already been ...
1
vote
Accepted
Avoid saving $_POST in Craft logs for certain URLs
As Oli commented, those will only be logged if devMode is enabled, which should never be the case in production.
Outside of that, Craft does have a sensitiveKeywords propery in the Security class: ...
1
vote
Accepted
Is it possible to allow logging at LEVEL_INFO without logging all the SQL queries?
This is what we ended up using.
<?php
return [
'components' => [
'log' => [
'targets' => [
[
'class' =&...
1
vote
How can I debug `craft\web\User::_validateUserAgentAndIp()` warnings
Most likely since it's a production site, it's from bots/scripts hitting the site's login page probing for vulnerabilities.
I'd suggest changing the cpTrigger config setting and see if the ...
1
vote
Accepted
How to read logs?
There are a bunch of Yii 2 log parsers and integrations with 3rd party logging services you could use https://packagist.org/?query=yii2%20log such as Graylog, Papertrail, Logstash, etc.
1
vote
Accepted
I do not have the /craft/storage/runtime/logs/ folder
Looks like that article needs to be updated for Craft 3.
In Craft 3, the logs folder is at storage/logs and you can search for [error] and find the one related to email sending.
1
vote
Is it possible to stop Craft from logging so much?
Even so this thread is old, maybe my answer can help someone:
Cleanup Craft Logs
Basically it's possible via app.php to remove all unnecessary logs such as all the $_GET, $_POST, $_SERVER variables ...
1
vote
Is it possible to stop Craft from logging so much?
We were having the same issue. Our logs were getting so dense with SQL statements that it was hard to find our errors. And for the most part, seeing Craft's internal SQL would not help us debug the ...
1
vote
Accepted
Craft 3 large log file sizes
Craft goes with Yii 2's defaults in the FileTarget class, which is 10MB for a log file before rotating. https://www.yiiframework.com/doc/api/2.0/yii-log-filetarget#$maxFileSize-detail
You can ...
1
vote
Can I find log activity of who deleted a user and who edited an entry?
Craft only stores minimum audit information in the database... mainly just when a row was created and last updated.
If you're on Craft 2, there is a deprecated Audit Log plugin which might do what ...
1
vote
wp-login.php bloating log files every 20-30 seconds
We've done the redirect route in Andrew's answer before and while it keeps some script kiddies out, it can also cause less "savvy" ones to think you actually have a valid WP installation and continue ...
1
vote
Accepted
TemplatesController error related to webfont!
TemplateController is what all template requests in Craft get routed through.
That error just means that someone/something is trying to load a resource (in your case yoursite.com/fonts/BlissBold-...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
logs × 35craft3 × 8
logging × 8
error-message × 4
plugin-development × 3
database × 3
config × 3
error × 3
image-transforms × 2
emails × 2
craft2 × 2
server × 2
404 × 2
users × 1
control-panel × 1
search × 1
form × 1
php × 1
cache × 1
admin × 1
query × 1
updates × 1
updating × 1
session × 1
tasks × 1