nette / tracy

😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.
https://tracy.nette.org
Other
1.75k stars 218 forks source link

Default setting log directory /log not works as written in documentation #557

Open mildabre opened 1 year ago

mildabre commented 1 year ago

Hi

I have Tracy 2.10.0 in pure PHP project installed via composer into /vendor directory. Development server PHP 8.2 on Windows, Production server on PHP 8.1 on Linux. On both servers is this unexpected behaviour:

First I have created directory /log for logging errors and expected as stated in documentation, that Tracy will automatically use this directory in Production mode for logging.

Directories in root directory:

/app
/log
/stat
/templates
/vendor/tracy

Documentation (Czech) here: https://tracy.nette.org/cs/guide#toc-produkcni-rezim-a-logovani-chyb

Citation: "Pokud neurčíme jinak, půjde o soubor log/error.log." and "Jiný adresář pro logování chyb lze nastavit druhým parametrem metody enable():"

These citation from documentation unquestionably follows that directory /log is default one and there is no need to configure it in the method Debugger::enable() with the second parameter.

But the real behaviour of Tracy isnt like this. Exception in Production mode cannot be logged into the default directory and follows SERVER ERROR We're sorry! The server encountered..... + Tracy is unable to log error.

So you MUST configure the log directory in each case:

Debugger::enable(Debugger::Detect, $rootDir.'/log');

After than logging errors works.

Proposal

a) Keep described function in documentation

b) Repair the function of Tracy so that the default directory works automatically without setting with Debugger::enable()

c) I also submit for consideration - in case that directory /log doesnt exists Tracy will automatically create this one

mildabre commented 1 year ago

Hi,

I have looked additionally into configuring Tracy in standard Bootstrap.php from nette/web-project skeleton, where is this code:

$configurator->enableTracy($appDir . '/log');

So I have deeply reconsidered my original proposal and I would like to change it:

a) let the function be as it is now

b) change the documentation and bring it into line with the real function - clearly define that log directory MUST be configured !!

Its up to you as experienced Nette leader which solution would be the best and in line with the current trend in php web development. I personally thing that it is more precise have the definition in the code than some default value.

dg commented 1 year ago

tl;Dr?

JanTvrdik commented 1 year ago

tl;Dr?

Tracy documentation should be fixed to mention that user need to configure logging directory, otherwise logging will not work at all.

dg commented 1 year ago

So please send PR