How can I check Drupal log files? - drupal

How can I check Drupal log files?
I'm using Ubuntu 10.10 + Apache2 + PHP 5.33 + MySQL and Drupal 7.

To view entries in Drupal's own internal log system (the watchdog database table), go to http://example.com/admin/reports/dblog. These can include Drupal-specific errors as well as general PHP or MySQL errors that have been thrown.
Use the watchdog() function to add an entry to this log from your own custom module.
When Drupal bootstraps it uses the PHP function set_error_handler() to set its own error handler for PHP errors. Therefore, whenever a PHP error occurs within Drupal it will be logged through the watchdog() call at admin/reports/dblog. If you look for PHP fatal errors, for example, in /var/log/apache/error.log and don't see them, this is why. Other errors, e.g. Apache errors, should still be logged in /var/log, or wherever you have it configured to log to.

If you love the command line, you can also do this using drush with the watchdog show command:
drush ws
More information about this command available here:
https://drushcommands.com/drush-7x/watchdog/watchdog-show/

Make sure drush is installed (you may also need to make sure the dblog module is enabled) and use:
drush watchdog-show --tail
Available in drush v8 and below.
This will give you a live look at the logs from your console.

We came across many situation where we need to check error and error logs to figure out issue we are facing we can check by possibly following method:
1.) On blank screen
Some time we got nothing but blank screen instead of our site or message written The website encountered an unexpected error. Please try again later , so we can Print Errors to the Screen
by adding
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
in index.php at top.;
2.) We should enable optional core module for Database Logging at /admin/build/modules, and then we can check logs your_domain_name/admin/reports/dblog
3.) We can use drush command also to check logs
drush watchdog-show it will show recent ten message
or if we want to continue showing logs with more information we can user
drush watchdog-show --tail --full.
4.) Also we can enable core Syslog module this module logs events of operating system of any web server.

We can use drush command also to check logs
drush watchdog-show it will show recent 10 messages.
or if we want to continue showing logs with more information we can user
drush watchdog-show --tail --full.

MAMP/logs/php_error.log
Above all given option does not work go to the MAMP/logs/ check all type of log-like.
mysql_error.log
nginx_error.log
apache_error.log

For drupal 9, you can access to your logs with drush , here some commands:
watchdog:delete (wd-del, wd-delete, wd) Delete watchdog log records.
watchdog:list (wd-list) Interactively filter the watchdog message listing.
watchdog:show (wd-show, ws) Show watchdog messages.
watchdog:show-one (wd-one) Show one log record by ID.
watchdog:tail (wd-tail, wt) Tail watchdog messages.
One more thing if your are not fan with commands, please in the Administrative menu, go to Reports > Recent log messages. On this page is a list of recent log messages which you can filter by type and severity.
but if your are professional you can configure ELK that's will give you all

In Drupal, you can check the log files through the Drupal admin interface or by accessing the server files directly. Here are the steps for each method:
Through the Drupal admin interface:
Log in to your Drupal site as an administrator.
Go to Reports > Recent log messages.
This will show you a list of recent log entries, filtered by severity level and type.
By accessing server files:
Connect to your server via FTP or SFTP.
Locate your Drupal installation directory.
Look for the "logs" directory or server level /var/log.
Open the log files you want to view.
Note: The location of the log files may vary depending on your Drupal installation and server configuration. You may need to consult your hosting provider or server administrator for help finding the logs.

Related

Drupal - Disable SAML login in local instance

I am very new to Drupal. I have done the local setup and the front end is working fine. Now I need to login to the admin interface. Seems like there is a SAML configuration and when I try to access the /user/login page it is showing the following error :
The website encountered an unexpected error. Please try again later.
I can see there is one simplesaml folder in the codebase and I think this is handling the SAML login. Now in the local setup, I don't need to use SSO, but not sure how to disable this extension. I have checked in the core.extension.yml, but the fllowing extensions set to 0 there and hence I think this is not activated.
basic_auth: 0
externalauth: 0
simplesamlphp_auth: 0
Also in my local configuration settings.local.php, it is set as false:
$config['simplesamlphp_auth.settings']['activate'] = FALSE;
It will be very much helpful if somebody can guide me in the right direction. I have access to the database, but not sure where I need to make changes. This might be a simple thing, but I am blocked here.
The Error I am seeing the logs is like this :
Uncaught PHP Exception SimpleSAML\Error\Exception: "Could not find the metadata of an IdP with entity ID 'localhost:default:entityId'" at /vendor/simplesamlphp/simplesamlphp/modules/saml/lib/Auth/Source/SP.php line 317
You can login to Drupal using a console command.
Open a terminal, navigate to the project folder like
cd ~/project/my-project/web/
Then run
drush uli
the output will be a one time login link.

Apache Airflow Webserver Log In Failed

I realise this is a duplicate of thousands of posts across the internet, but I have only found solutions for version <2.0, and those solutions do not apply to >2.0.
Basically, I have installed Apache Airflow on an Ubuntu system. Everything installed fine, as far as I see from command line, and I first create a user:
airflow users create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin
And then from here I start up the webserver and scheduler:
airflow webserver -p 8585 > ${AIRFLOW_HOME}/logs/webserver.log 2>&1 &
airflow scheduler > ${AIRFLOW_HOME}/logs/scheduler.log 2>&1 &
And then I can access the webserver via "http://<HOST_IP>:8585" - This loads to the log in screen no problem.
But when I try to log in using the user details initially created, or by using my OS user (on the off-chance), it just fails with "Invalid login." I've tried restarting the webserver and Ubuntu to no avail.
I've used Airflow <2.0 in the past and never even created a user and just logged in straight away, so I'm really blank on what the answer is here. I absolutely hate Airflow and am loosing my mind just trying to log in, so a massive thanks for any help!
Okay, sooo I managed to get it running with login potential. I think I've discovered the issue, at least, and can re-create the problem, though frankly I have ZERO idea why it IS an issue (software coded issue??).
Basically, I had to run the install processes above as ROOT user. I was trying to run it as my admin user, but it kept resulting in the log in issue above - I did notice however that all install guides appear to use the ROOT user, so I gave it a shot in case it was as annoyingly simple as that, and VOILA!! First time logged in.
I did stop the software running at this point, quickly restart it as my admin user and immediately got the same login issue. There's something odd going on here, and I don't know what it is, but when in doubt: Try ROOT.
Solution- Create user again
I ran into the same issue. I had created an Admin user using the same command and after some changes to my config file, I ran airflow db init. After this when I started the webserver, I tried logging in with my admin credentials, but no luck. When I checked the logs, it showed me -
WARNING - No user yet created, use flask fab command to do it.
So I created the user again and it worked.

Drupal apc module

I have deployed drupal site on my dev env and I can view the frontend of the site. The Site pages are cached using APC server cache module installed on drupal.
The Issue is that I'm not able to clear the cache using Admin Console of Drupal CMS because after login I get the error -
Fatal error: Call to undefined function apc_delete() in C:\xampp\htdocs\nrdrupaldev\sites\all\modules\apc\drupal_apc_cache.inc on line 289
As the Admin is not accessible due to the above error I tried to disable the module directly from the Database using this query -
UPDATE system SET status='0' WHERE name='apc'
After this I also disabled the module from settings.php by removing its config settings.
But this gave me a series of errors and warnings see below image ![enter image description here][1]
First thing to check is your PHP version. APC no longer works in PHP 5.5+ so you will need the APCu extension.
If you are getting an error stating that a function that belongs to APC is not defined it's safe to say that the extension is not being loaded.
I have not used the APC Drupal module for some time as I has switched my caching needs to Redis but I believe it was updated to support APCu.

Drupal - White Screen of Death after updates (and login page returning 403 error)

I have just updated a site that is using Drupal and have now experienced the horrible WSOD.
I have searched through Google looking for any sort of solution/error log to help me find and fix the issue but nothing has worked. I have tried adding in the 'display errors' code in the index.php file and looked at the error_log file in the public directory and nothing.
I can not login to the admin page and check any modules as the login page for this is returning a 403 error.
Any suggestions?
Please go to Apache Error log. You will exact error messages there.
The log file's location is different for different OS and versions.
e.g httpd/log/error.log
Maybe your Drupal registry is broken.
Fix this using the registry_rebuild script (this is no module!)
There are times in Drupal 7 when the registry gets hopelessly hosed and you need to rebuild the registry (a list of PHP classes and the files they go with). Sometimes, though, you can't do this regular cache-clear activity because some class is required when the system is trying to bootstrap.
You might get something like:
PHP Fatal error: Class 'EntityAPIControllerExportable' not found in ...sites/all/modules/rules/includes/rules.core.inc on line 11
If this happens when you're trying to run update.php, and happens when you're trying to clear your cache, well, you have some trouble. That's what Registry Rebuild is for.
It also may happen that you've moved some module that Drupal requires to bootstrap, and you get a horrible error. Registry Rebuild will also rebuild the system table to get the modules in the right place so you can bootstrap.
You will need PHP-CLI or drush to run this.
https://drupal.org/project/registry_rebuild

Hudson trigger builds remotely gives a forbidden 403 error

I have a shell script on the same machine that hudson is deployed on and upon executing it, it calls wget on a hudson build trigger URL. Since its the same machine, I access it as http://localhost:8080/hudson/job/jobname/build?token=sometoken
Typically, this is supposed to trigger a build on the project. But I get a 403 forbidden when I do this. Anybody has any idea why? I have tried this using a browser and it triggers the build, but via the command line it doesn't seem to work. Any ideas?
I figured it out. Apparently if Hudson is protected using a security mechanism, you need to authenticate the build requests. See this wiki link for more details http://wiki.hudson-ci.org/display/HUDSON/Authenticating+scripted+clients
Since I used the auth mechanism that was shipped with Hudson, calling the build scripts invovled. I used
wget --auth-no-challenge --http-user=user --http-password=password http://hudson.yourcompany.com/job/your_job/build?token=TOKEN
to run the build script.
If you use matrix-based security, you can set Job Read and Job Build permission to Anonymous, so you don't need a user and password in your post-commit hook.
Another tip is to turn on polling without setting a date and use this URL:
http://hudson.yourcompany.com/job/your_job/polling?token=TOKEN
Your job will be build just if there were svn changes (no need to build when changing other projects, creating tags etc.)
I got the same errors. In my case I had to add the Jenkins-Crumb header to the HttpPost object to make it work.
post.addHeader("Jenkins-Crumb","crumb value");
To find the crumb value for your Jenkins instance, install Firebug or any plugin n your browser which will help you see the request headers. Go to your job page at http://server_name:port/jenkins/job/job_name
Press F12 to activate Firebug, got to Net tab. Click Enable Auto - refresh link at top right of your page. Now every 5 seconds you should see an Ajax Request being made to fetch the buildHistory. In that request, examine the headers. There should be a header for Jenkins-Crumb, it can also be under name .crumb depending the Jenkins version you are using. You it in your Java code.

Resources