mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
Page:
Logging
Pages
Branches and releases
Coding guidelines
Compilation of personal plugins
Database upgrade
Git workflow and best pratices
Home
How to create a theme
Logging
Migrate a plugin from Piwigo.org SVN to Github
Multiple Site (Multisite)
Piwigo Web API
Plugin Tutorial: Hello world!
Plugin Tutorial: Several tricks from the Copyrights plugin
Plugin developpement
Publishing an extension
Security and coding
Send emails with Piwigo
Technical changes in Piwigo 11
Technical changes in Piwigo 12
Technical changes in Piwigo 13
Technical changes in Piwigo 14
Technical changes in Piwigo 15
Technical changes in Piwigo 16
Technical changes in Piwigo 2.10
Technical changes in Piwigo 2.2
Technical changes in Piwigo 2.3
Technical changes in Piwigo 2.4
Technical changes in Piwigo 2.5
Technical changes in Piwigo 2.6
Technical changes in Piwigo 2.7
Technical changes in Piwigo 2.8
Use a source code manager for your extension
pwg.images.add and pwg.images.addChunk
pwg.images.addSimple
pwg.images.upload
Clone
1
Logging
Pierrick Le Gall edited this page 2025-12-10 15:09:12 +01:00
Table of Contents
How to deal with log messages?
In Piwigo you have a $logger object, available at any time in your code. By using it, the message will be added in the right file, at the right place. The logging system generates one file per day and (by default) keeps the 30 last days:
$ ll _data/logs/
total 280
-rw-rw-rw- 1 www-data www-data 12 Oct 19 2022 index.htm
-rw-r--r-- 1 www-data www-data 9316 Nov 10 16:22 log_2025-11-10_0b5695e16ff4cca0df6e332b469eb105d2bc6e71.txt
-rw-r--r-- 1 www-data www-data 9260 Nov 11 18:45 log_2025-11-11_82170d05069d936e59e8a293d1ff8e1d5f79b4d7.txt
-rw-r--r-- 1 www-data www-data 104 Nov 12 11:30 log_2025-11-12_761f3addaf7ad2c2fd71f1c45393e72df903d367.txt
-rw-r--r-- 1 www-data www-data 208 Nov 13 17:57 log_2025-11-13_919aee1f3dee54623c481aa3168fc7843db41c1b.txt
-rw-r--r-- 1 www-data www-data 1001 Nov 14 17:35 log_2025-11-14_d30be0f55d811b4bbab9e561c9368d1299313eec.txt
-rw-r--r-- 1 www-data www-data 2844 Nov 17 17:03 log_2025-11-17_fa93d9c73e8f8d7543b460a357522fbe1095adc1.txt
-rw-r--r-- 1 www-data www-data 14460 Nov 18 18:34 log_2025-11-18_e36eef127b01d951ba4b579259c29e8f15dc834e.txt
-rw-r--r-- 1 www-data www-data 28083 Nov 19 14:22 log_2025-11-19_29854df472a63f60e7645d372d9b4bc87af86a0e.txt
-rw-r--r-- 1 www-data www-data 3539 Nov 20 19:37 log_2025-11-20_f84f7e147daf80d6e26a87b564cc062c89988bef.txt
-rw-r--r-- 1 www-data www-data 55427 Nov 21 17:33 log_2025-11-21_bee5fdc5f3d1c7f729ae3832e5207b99b1a55c52.txt
-rw-r--r-- 1 www-data www-data 568 Nov 24 15:30 log_2025-11-24_2f61236df90467d8d092ecd80e57ea96d0ea8825.txt
-rw-r--r-- 1 www-data www-data 38241 Nov 25 17:01 log_2025-11-25_45148d65614ee51e285ac2ca7444ce381e212ce3.txt
-rw-r--r-- 1 www-data www-data 9921 Nov 27 12:25 log_2025-11-27_8346767718dbc7f3635b87d95e2c0c523629a17f.txt
-rw-r--r-- 1 www-data www-data 30303 Nov 28 23:49 log_2025-11-28_4f40b311d5fad41081a2def89696e1ad45816fd2.txt
-rw-r--r-- 1 www-data www-data 2329 Nov 29 18:46 log_2025-11-29_61f2b6d759239a066c972c47cd8b15c2047d9ec0.txt
-rw-r--r-- 1 www-data www-data 4171 Dec 1 15:05 log_2025-12-01_e3c77e81151926c3db20bba077e98ec96fb2d17f.txt
-rw-r--r-- 1 www-data www-data 2079 Dec 2 14:46 log_2025-12-02_00d86aab5e3b92f0504eb27c32b600332273f783.txt
-rw-r--r-- 1 www-data www-data 104 Dec 3 11:57 log_2025-12-03_b8a9e0615e298878851ed39bac2e6dd110b87bec.txt
-rw-r--r-- 1 www-data www-data 3823 Dec 6 14:07 log_2025-12-06_c765c0b8686ea84cf656a94f4426114e3b960f55.txt
-rw-r--r-- 1 www-data www-data 7129 Dec 8 18:41 log_2025-12-08_a489fd4b2112d06ce879ddc83f90c6b47668a61d.txt
The log filename is log_<year>-<month>-<day>_<random string>.txt. With the random string, the log filepath can't be discovered by a direct HTTP access.
In your PHP code:
global $logger; // required only in functions
$logger->info('['.__FUNCTION__.'] conf is not writeable, abort');
$logger->debug('[admin/intro::'.__LINE__.'] recent activity calculated in '.get_elapsed_time($start_time, get_moment()));