garydgregory commented on code in PR #264:
URL: https://github.com/apache/commons-daemon/pull/264#discussion_r2095744028


##########
src/native/windows/apps/prunsrv/prunsrv.c:
##########
@@ -2204,8 +2217,11 @@ void __cdecl main(int argc, char **argv)
     gStdwrap.szLogPath = SO_LOGPATH;
     /* Only redirect when running as a service */
     if (lpCmdline->dwCmdIndex == 2) {
+        apxLogWrite(APXLOG_MARK_DEBUG "redirect!");
         gStdwrap.szStdOutFilename = SO_STDOUTPUT;
         gStdwrap.szStdErrFilename = SO_STDERROR;
+    } else {
+        apxLogWrite(APXLOG_MARK_DEBUG "NO redirect!");

Review Comment:
   Same comments as above. Also "NO" doesn't need to be capitalized. Sentences 
start with a capital, sure.



##########
src/native/windows/apps/prunsrv/prunsrv.c:
##########
@@ -347,9 +353,11 @@ static BOOL redirectStdStreams(APX_STDWRAP *lpWrapper, 
LPAPXCMDLINE lpCmdline)
         if ((lpWrapper->fpStdOutFile = _wfsopen(lpWrapper->szStdOutFilename,
                                                L"a",
                                                _SH_DENYNO))) {
-            _dup2(_fileno(lpWrapper->fpStdOutFile), 1);
-            *stdout = *lpWrapper->fpStdOutFile;
+            int ret = _dup2(_fileno(lpWrapper->fpStdOutFile), 
(_fileno)(stdout));
+            if (ret == -1)
+                apxLogWrite(APXLOG_MARK_ERROR "redirectStdStreams _dup2 failed 
on stdout");

Review Comment:
   How about using "redirectStdStreams()" instead of "redirectStdStreams" to 
make it obvious the context is within a function?
   



##########
src/native/windows/apps/prunsrv/prunsrv.c:
##########
@@ -2204,8 +2217,11 @@ void __cdecl main(int argc, char **argv)
     gStdwrap.szLogPath = SO_LOGPATH;
     /* Only redirect when running as a service */
     if (lpCmdline->dwCmdIndex == 2) {
+        apxLogWrite(APXLOG_MARK_DEBUG "redirect!");

Review Comment:
   I don't think we need exclamations in debug log messages! 😉 
   
   More seriously, I think this kind of log message is unhelpful. How about 
saying _what_ we are redirecting to _where_?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to