-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Unify chanserv logging (2020-07) #1633
Conversation
Great work @aquesnel ! I've got a few comments for you, all related to debugging:-
A relatively simple to run with
The above isn't perfect but it gives you an idea of what's going on. How important it is to solve this all right now is probably a question for @metalefty. It's pretty tricky for normal users to run with log level debug anyway. Hope this is useful. |
Thanks for the feedback @matt335672 . I'll likely have an update for this pull request based on your feedback next week (2020-07-20). I'm thinking of adding the function and line numbers to the existing logging macro with something like what is described here: I'm also thinking of adding the function and line numbers to the logs for all log statements when XRDP_DEBUG=true Is this a good idea? I'm going to assume that all of the logging that used to go to the console should be at the TRACE level. I'll update the logging statements setting the level based on: DEBUG is for the sys admin to debug xrdp and TRACE is for the devs to debug xrdp. Is there any other guidance for the logging levels you want in the pull request? next actions
|
Hi @aquesnel I think your suggested approach to move existing console output to TRACE level is exactly right. We could spend ages debating exactly what and what not should be moved around here, but I think the pragmatic thing to do is sort out the general case first and get the developer output sorted out later, maybe when we're working on a particular feature. I don't completely understand what you're proposing with the new logging macro based on XRDP_DEBUG. Can you illustrate with an example? I've got some other more general comments which you may find useful:-
I hope that's useful - let me know if you've any queries. |
Hi @matt335672, I'm a Java programmer in my day job and it's been a long time since I've worked in C, so letting me know that My plan for adding function and line number when XRDP_DEBUG=true is to do something like:
For logging from a single module, I'd normally think of filtering the logging with a config value (like the log4j logger config) but that's too complex for what's here. I'll brainstorm something and get back to you with a simpler solution. Maybe I'll add a macro like FORCE_LOGGING that can be defined in any file that to have logging enabled, or maybe add some simple config in the existing ini file. |
OK - that's clearer thanks. You might also find it useful when retro-fitting the TRACE stuff to add a LOG_LOC() macro (or whatever name suits. LOGT()?) which unconditionally calls As regards reading the config file, I've just put in a PR #1635 which adds a config module to chansrv. If @metalefty 's happy with it it might make parsing the config file easier to do. |
Hi @matt335672, I think I've addressed all of your feedback, please let me know if there is anything that I missed or there is any feedback for my modifications. Also, I've been having a hard time reproducing the errors that are causing the travisci builds to fail when I build on my dev machine. When I run with following config I get an error in code that I haven't touched, and the travisci builds don't seem to build the common/pixman-region.c file.
I've been trying to work around this issue by building only the chansrv with the warnings as errors flags, but it's a pain.
Please let me know if there is a better way to reproduce the travisci builds on my dev machine. progress report
|
Hi @aquesnel, The compile error you're seeing is being caused by the odd way that The way it currently works is:-
I hope that's clear enough - it wasn't to me for some time! The error you're seeing is a consequence of A simple fix is to add the function prototype to the affected codepath:- --- a/common/pixman-region.c
+++ b/common/pixman-region.c
@@ -91,6 +91,8 @@
#ifdef XRDP_DEBUG
+pixman_bool_t PREFIX(_selfcheck) (region_type_t *reg);
+
#define GOOD(reg) \
do \
{ \ The compilation then generates further warnings I'm afraid in the Replicating Travis CI on a local machine is quite tricky. Another way is register your own github repo with travis-ci.org directly and then any private branches you push to it with get scanned for you. Hope that's useful. |
I've had a quick run of your changes, and that's certainly fixed the performance issues with setting a DEBUG level. One comment so far - there's a bit or a name clash between Could I suggest replacing Thanks. |
@matt335672 I like the name |
Hi @matt335672, I've registered my repo with travisci and that helped make a clean build. I didn't realize that I could register my repo for builds too, so thanks for the pointer. I'm all for making code easier to understand. One of my first team leads had a rule for making code easier to understand that I live by now: "an acronym or abbreviation is only allowed in the code if it is commonly used by a layman (eg. 'id' is allowed, but ODSL is disallowed)" I've implemented the renaming from LOG_DBG to LOG_DEVEL, and I think it's a lot clearer when each macro should be used. When I was madding LOG_DBG in the previous commits I was asking myself "should this debug log message be LOG_DBG or LEVEL_DEBUG" and this renaming bypasses the question quite clearly. I've added some documentation to the logging macros to try and make this usage of the macros consistent in the future. This past weekend I'd made a script to make the log renaming the changes for the various log methods, so once this pull request is merged, I plan on making another pull request for unifying the logging in the rest of the code. Please let me know if there is any other feedback before this pull request is ready to be merged. |
Hi @aquesnel Thanks again for all your work on this - it's been outstanding for a while, I've had a quick look at the comments and that helps a lot. One thing you could do is make then Doxygen compatible (if you're familiar with the tool). I'm hoping to move in that direction eventually so we can get some better generated docs. If you're not familiar I wouldn't worry too much as we're going to need to do a bit of a retro-fit anyway to all sorts of things. @metalefty will need to review this before it's merged, and I know he's not available for a week or two. He'll probably want you to squash your commits, but it's probably worth holding off on that until he's had a look at the history. |
Hi @matt335672 , I've updated the documentation for the LOG and LOG_DEVEL macros so they should work with doxygen. I've also added additional logging config options:
Please let me know if there is any other feedback before this pull request is ready to be merged. progress report
|
Nothing from me - @metalefty will need to take a look at this before the merge happens. Thanks again for all your work on this. |
Thanks, I'll have a look within a few days. |
I haven't tested your work yet however it seems a big update. So I'm thinking of merging this after the August release. |
Hi @metalefty , That sounds reasonable to merge this change after this month's release. I didn't see any tests in the repo, so I've just been verifying my changes by compiling and manually running the code. Do you have another way to test changes? When you have time, could you please let me know if these changes are ok, since these changes are different than the logging clean up that you outlined in the Reworking logs wiki page. If the changes are ok, then I'll go ahead and work on migrating the logs in the rest of the repo to these new unified log macros while the merge is pending. Also, as you mentioned the change being large, and I'm proposing making more large changes to migrate the other log statements, do you have a preference on how i organize the pull requests? I'm planning on submitting one pull request for the log migration of each directory in the repo. Let know if there is another way that I can make your review of the changes easier. Thanks |
@metalefty - I've got another (small) fix identified in #1658 which conflicts with this one and I think this one should go in first. @aquesnel - could you add a quick summary of where your changes are at odds with the Reworking logs wiki page? We can then agree how to work through the differences. Thanks both. |
The difference between this pull request and the Reworking logs page is:
Also I've added a few logging features which are not conflicting with the Reworking logs page:
|
Hi @metalefty Now that 0.9.14 has been released, can you please take a look at this pull request and let me know if you have any feedback for this change to get merged? Thanks |
Sure. There's some pending pull requests. We'll process one by one. Thank you very much for your great work. |
@matt335672 anything else from you? |
I'm just running through some additional testing, and I can see I'll have a few minor questions/queries. I'm a bit strapped for time today sadly, so I'll report back tomorrow. |
The only significant comments I have are around the new comment at the top of log.h:- * Note: when the build is configured with --disable-xrdpdebug, then * the source file name and log level can be added to the [Logging_PerLogger] * section of xrdp.ini to change the logging level for logs in that source file. * * For example in xrdp.ini: * ``` * [Logging_PerLogger] * xrdp.c=DEBUG * ``` Two minor comments:-
A more major question is that this looks like a useful feature, but it's not going to be available to chansrv, because this doesn't use |
hi @matt335672 That's a good point that I've added log filtering, but it's not usable for the chansrv. I've fixed this up so that chansrv can initialize the logs just like sesman, from the sesman config. fixed
TODO
|
I think I've made the chansrv logging behaviour backwards compatible with the log level environment variable and syslog. I've also added the [Chansrv_Logging] section to the sesman.ini file to enable independent logging configuration of sesman and chansrv. |
b4d085f
to
a452b66
Compare
Hi @matt335672 and @metalefty , |
Hi, I'm been away for a while. I'll do a quick test today. |
sesman/sesman.ini.in
Outdated
#ConsoleLevel=INFO | ||
#EnableProcessId=false | ||
|
||
[Logging_PerLogger] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like _
(underscore) here. SessionVariables
is spelled camel case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 65347e4 to use camel case for the config names.
Sorry, I've been testing with auto login enabled, I'll make sure to test with the login screen. I should have time this weekend to fix this. |
3f3e8b0
to
04dff6a
Compare
Hi @metalefty , I've fixed the login screen issue and I've squashed the fix and rebased on top of devel. Please let me know if there are any other issues that I need to fix before merging. |
This commit adds: * replace multiple logging macros with LOG and LOG_DEVEL * logging configuration for chanserv * logging configuration for console output * logging configuration for per file or method log level filtering for debug builds * file, line, and method name in log message for debug builds
65347e4
to
a9ec1eb
Compare
Hi @metalefty , Please let me know if there are any other issues that I need to fix before merging. |
LGTM. Let's merge it. If we found some additinal things needs to be fixed, it can be done later. |
@aquesnel Thank you very much for your work and spending a lot of time on xrdp! |
The ChansrvLogging section name was added and changed in neutrinolabs#1633 but this documentation line was missed when renaming the section name.
Merging pull request #792 with the most recent commit of devel.
I've created this pull request since pull request #792 seems to have been abandoned, and I am working on similar debug logging changes. Please let me know if there are still reasons why pull request #792 was not merged, so that I can address them.