Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging is not working When using Zebra_Session #69

Open
Albatroon opened this issue Aug 8, 2021 · 6 comments
Open

Logging is not working When using Zebra_Session #69

Albatroon opened this issue Aug 8, 2021 · 6 comments
Assignees
Labels

Comments

@Albatroon
Copy link

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 ?

@stefangabos
Copy link
Owner

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

@Albatroon
Copy link
Author

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

@stefangabos
Copy link
Owner

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?

@Albatroon
Copy link
Author

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.

if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest')

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 👍

@stefangabos
Copy link
Owner

stefangabos commented Aug 9, 2021

  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

@Albatroon
Copy link
Author

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

@stefangabos stefangabos reopened this Nov 23, 2021
@stefangabos stefangabos self-assigned this Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants