[GH-ISSUE #25] Is there any output? #11

Closed
opened 2026-03-04 23:23:42 +03:00 by kerem · 4 comments
Owner

Originally created by @nkakouros on GitHub (Aug 1, 2017).
Original GitHub issue: https://github.com/yswery/PHP-DNS-SERVER/issues/25

Awesome project! To my question.

It would be nice to somewhere to log requests. Is there any such capability now?

Originally created by @nkakouros on GitHub (Aug 1, 2017). Original GitHub issue: https://github.com/yswery/PHP-DNS-SERVER/issues/25 Awesome project! To my question. It would be nice to somewhere to log requests. Is there any such capability now?
kerem closed this issue 2026-03-04 23:23:43 +03:00
Author
Owner

@yswery commented on GitHub (Aug 1, 2017):

Currently speaking, no there is no logging

However would love to see this come through as a PR if you got time, some foreground output/logging

In the ds_handle_query() method you will find the first entry point where you can see who made the query and what the query was: https://github.com/yswery/PHP-DNS-SERVER/blob/master/src/Server.php#L62

later in this method the question query is decoded so you will have the ability to print something in there about who did the DNS query and what they asked for and what the response is.

I think thats the best place to start with output logs inside that method, if you are not familiar with the protocol, a good way to go through this would be to just print out all the variables one by one inside the ds_handle_query() method to see what they store as your query the DNS server and that way by trial and error you can see and learn what holds what :)

Would be good to have this logging as some configurable option in order to turn it off/on for those who want it.

<!-- gh-comment-id:319493118 --> @yswery commented on GitHub (Aug 1, 2017): Currently speaking, no there is no logging However would love to see this come through as a PR if you got time, some foreground output/logging In the `ds_handle_query()` method you will find the first entry point where you can see who made the query and what the query was: https://github.com/yswery/PHP-DNS-SERVER/blob/master/src/Server.php#L62 later in this method the question query is decoded so you will have the ability to print something in there about who did the DNS query and what they asked for and what the response is. I think thats the best place to start with output logs inside that method, if you are not familiar with the protocol, a good way to go through this would be to just print out all the variables one by one inside the `ds_handle_query()` method to see what they store as your query the DNS server and that way by trial and error you can see and learn what holds what :) Would be good to have this logging as some configurable option in order to turn it off/on for those who want it.
Author
Owner

@samuelwilliams commented on GitHub (Aug 1, 2017):

It might be worth adding a PSR Logger interface to the constructor or the aware interface to the class. You could then use a null logger as the default, or implement some other logging library such as Monolog.

<!-- gh-comment-id:319515452 --> @samuelwilliams commented on GitHub (Aug 1, 2017): It might be worth adding a [PSR Logger](https://github.com/php-fig/log) interface to the constructor or the aware interface to the class. You could then use a null logger as the default, or implement some other logging library such as [Monolog](https://github.com/Seldaek/monolog).
Author
Owner

@ivanstan commented on GitHub (May 17, 2018):

Currently working on Event Listeners in Server class, my idea was to create listener and than do the logging inside them. I would also recommend throwing Exception instead of using ds_handle_query() in cases where it should lead to stopping server

<!-- gh-comment-id:389766814 --> @ivanstan commented on GitHub (May 17, 2018): Currently working on Event Listeners in Server class, my idea was to create listener and than do the logging inside them. I would also recommend throwing Exception instead of using `ds_handle_query()` in cases where it should lead to stopping server
Author
Owner

@samuelwilliams commented on GitHub (Sep 15, 2018):

You can implement it with the EchoLogger in branch version-1

<!-- gh-comment-id:421528229 --> @samuelwilliams commented on GitHub (Sep 15, 2018): You can implement it with the EchoLogger in branch version-1
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/PHP-DNS-SERVER#11
No description provided.