Zebra_Database icon indicating copy to clipboard operation
Zebra_Database copied to clipboard

Logging is not working When using Zebra_Session

Open Albatroon opened this issue 3 years ago • 6 comments

I can't get Zebra_Database log queries to log file when using Zebra_Session. I am using last version on both classes. Logging is working great with out using the Session class Any clues what cases this ?

Albatroon avatar Aug 08 '21 10:08 Albatroon

What exactly is not working? What is the error message?

stefangabos avatar Aug 09 '21 06:08 stefangabos

Sorry, It was a bug in my code. Great job by the way (Y)

Albatroon avatar Aug 09 '21 14:08 Albatroon

Hey, maybe you can tell me what you'd want different in the file logging? I used this opportunity to have a look at the output - i don't use this feature usually - and I noticed it didn't look that good and that it could use some improvements I was thinking about formatting the SQL query rather than being in a single line. Do you have any other requests?

stefangabos avatar Aug 09 '21 15:08 stefangabos

I always use this feature. Very handy when I write a lot of mobile apps backend. I could monitor & debug MySQL quires without interrupt the final JSON output . Here's some improvement related to my issue. The 1st one is the logging is completely disabled when I use the class in an Ajax request, fixed by commit line 827. https://github.com/stefangabos/Zebra_Database/blob/df8d6dd2a8d86d298f8a970f49b7b9a0180bbd7d/Zebra_Database.php#L827 And set $db->debug = array(false,false,false), The logs goes to the log file & no debugging information printed on the screen..

2nd one, when setting $db->debug = true, The get debugging information printed on screen but without log to logfile. It will be nice to enable both. I preferred log to file rather than on screen.

Also, formatting the query will be great
Thank you for such a great classes 👍

Albatroon avatar Aug 09 '21 16:08 Albatroon

  1. right, when AJAX i should disable only printing on screen - as that would mess up everything, but still log to file if set so - ok
  2. i have no idea how to do both without sacrificing backward compatibility. maybe a new way of setting the value of $debug - suggestions are welcome

stefangabos avatar Aug 09 '21 16:08 stefangabos

What about adding a new config parameter, for printing on screen, Ex. $db->printOnScreen = true/false - maybe set to false by default. And leave the other $debug var for file logging only ! I think this is the best way for backward compatibility

Albatroon avatar Aug 09 '21 16:08 Albatroon