Community
Participate
Working Groups
Build Identifier: When the TCF agent runs in daemon mode, its associated output is sent to the system logger. This becomes problematic when the user asks for logging to be enabled using the -L /path/to/log/file option. In this case, the agent will indeed enable logging but the user log file will remain empty. The attached patch (on today's HEAD) fixes this with the following behavior: 1. The command line no more accepts both -d and -L options at the same time. An error message is shown instead. 2. The tracing infrastructure now also checks whether daemon mode is enabled to know when to output trace messages. I am not sure whether point #2 above has performance issues (two tests instead of one). Other possible approaches : a. setting log_name to '-' (stderr). This meant #defining a constant for the associated option (currently only open_log_file() knows about it). b. setting log_file to stderr but this modifies the variable from another source file. It is indeed a global but I am not sure whether it is the best way to do it. A limitation of the current patch is that since we cannot use -L w/ -d, the logging level has to be set by means of -l. I welcome your guidance on these two aspects. I can submit another patch if needed. In addition, I have modified the small agent help text (see #384049 for more info about it) to clearly state that messages are sent to the system logger when in daemon mode. Reproducible: Always Steps to Reproduce: 1. Clone the agent git repo and build it. 2. On a Unix system, run the agent in daemon mode with both '-d' and '-L foo' specified. 3. Note how 'foo' remains empty.
Created attachment 218171 [details] Proposed fix
Created attachment 218176 [details] Better patch This new patch touches less code and only adds an error when the user attempts to log to something else than stderr when in daemon mode. This version is better performance-wise (no additional handling in trace() macro) and allows to still enable logging by means of -L- (i.e default log level continues to work).
Created attachment 218177 [details] Version with fewer changes and agent updated help text This version adds the small update to the agent help text.
The last version of the patch looks very good. Committed. Thanks!
Comment on attachment 218177 [details] Version with fewer changes and agent updated help text iplog- since git has the author: http://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git/commit/?id=219157000832ba8201a6043abe79591480aa0eda