Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 38321E3ED for ; Tue, 5 Feb 2013 16:29:48 +0000 (UTC) Received: (qmail 22108 invoked by uid 500); 5 Feb 2013 16:29:37 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 16883 invoked by uid 500); 5 Feb 2013 16:29:26 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 7715 invoked by uid 99); 5 Feb 2013 16:28:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 16:28:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 16:28:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 39E5523889ED; Tue, 5 Feb 2013 16:28:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1442650 - in /commons/proper/daemon/branches/1.0.x/src/native/windows: apps/prunmgr/prunmgr.h apps/prunmgr/prunmgr.rc apps/prunsrv/prunsrv.h apps/prunsrv/prunsrv.rc include/log.h src/log.c Date: Tue, 05 Feb 2013 16:28:35 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130205162836.39E5523889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Tue Feb 5 16:28:35 2013 New Revision: 1442650 URL: http://svn.apache.org/viewvc?rev=1442650&view=rev Log: DAEMON-276 Fix log file corruption Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.h commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.rc commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.h commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.rc commons/proper/daemon/branches/1.0.x/src/native/windows/include/log.h commons/proper/daemon/branches/1.0.x/src/native/windows/src/log.c Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.h URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.h?rev=1442650&r1=1442649&r2=1442650&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.h (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.h Tue Feb 5 16:28:35 2013 @@ -24,7 +24,7 @@ #define _PRUNMGR_H #undef PRG_VERSION -#define PRG_VERSION "1.0.12.0" +#define PRG_VERSION "1.0.13.0" #define PRG_REGROOT L"Apache Software Foundation\\Procrun 2.0" #define IDM_TM_EXIT 2000 Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.rc URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.rc?rev=1442650&r1=1442649&r2=1442650&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.rc (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunmgr/prunmgr.rc Tue Feb 5 16:28:35 2013 @@ -228,7 +228,7 @@ END STRINGTABLE BEGIN IDS_APPLICATION RSTR_PSM - IDS_APPVERSION "Version 1.0.12" + IDS_APPVERSION "Version 1.0.13" IDS_APPFULLNAME RSTR_PSM " Version " PRG_VERSION IDS_APPCOPYRIGHT "Copyright (c) 2000-2013 The Apache Software Foundation" IDS_APPDESCRIPTION "Apache Commons Daemon Service Management Tool" @@ -259,8 +259,8 @@ BEGIN END 1 VERSIONINFO - FILEVERSION 1,0,12,0 - PRODUCTVERSION 1,0,12,0 + FILEVERSION 1,0,13,0 + PRODUCTVERSION 1,0,13,0 FILEFLAGSMASK 0x3fL #if defined(_DEBUG) FILEFLAGS 0x03L Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.h URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.h?rev=1442650&r1=1442649&r2=1442650&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.h (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.h Tue Feb 5 16:28:35 2013 @@ -25,7 +25,7 @@ #define _PRUNSRV_H #undef PRG_VERSION -#define PRG_VERSION "1.0.12.0" +#define PRG_VERSION "1.0.13.0" #define PRG_REGROOT L"Apache Software Foundation\\Procrun 2.0" #endif /* _PRUNSRV_H */ Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.rc URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.rc?rev=1442650&r1=1442649&r2=1442650&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.rc (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.rc Tue Feb 5 16:28:35 2013 @@ -23,8 +23,8 @@ IDI_MAINICON ICON CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "prunsrv.manifest" 1 VERSIONINFO - FILEVERSION 1,0,12,0 - PRODUCTVERSION 1,0,12,0 + FILEVERSION 1,0,13,0 + PRODUCTVERSION 1,0,13,0 FILEFLAGSMASK 0x3fL #if defined(_DEBUG) FILEFLAGS 0x03L Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/include/log.h URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/include/log.h?rev=1442650&r1=1442649&r2=1442650&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/include/log.h (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/include/log.h Tue Feb 5 16:28:35 2013 @@ -38,6 +38,16 @@ __APXBEGIN_DECLS UnlockFile(file, 0, 0, 512, 0); \ APXMACRO_END +#define APX_LOGENTER() \ + if (_pt_sys_loglock) \ + EnterCriticalSection(_pt_sys_loglock); \ + else (void)0 + +#define APX_LOGLEAVE() \ + if (_pt_sys_loglock) \ + LeaveCriticalSection(_pt_sys_loglock); \ + else (void)0 + #define APXLOG_LEVEL_DEBUG 0 #define APXLOG_LEVEL_INFO 1 #define APXLOG_LEVEL_WARN 2 Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/src/log.c URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/src/log.c?rev=1442650&r1=1442649&r2=1442650&view=diff ============================================================================== --- commons/proper/daemon/branches/1.0.x/src/native/windows/src/log.c (original) +++ commons/proper/daemon/branches/1.0.x/src/native/windows/src/log.c Tue Feb 5 16:28:35 2013 @@ -41,9 +41,10 @@ typedef struct apx_logfile_st { } apx_logfile_st; /* Per-application master log file */ -static apx_logfile_st *_st_sys_loghandle = NULL; - -static apx_logfile_st _st_sys_errhandle = { NULL, APXLOG_LEVEL_WARN, FALSE}; +static apx_logfile_st *_st_sys_loghandle = NULL; +static CRITICAL_SECTION _st_sys_loglock; +static CRITICAL_SECTION *_pt_sys_loglock = NULL; +static apx_logfile_st _st_sys_errhandle = { NULL, APXLOG_LEVEL_WARN, FALSE}; static void logRotate(apx_logfile_st *lf, LPSYSTEMTIME t) { @@ -171,6 +172,10 @@ HANDLE apxLogOpen( SYSTEMTIME sysTime; apx_logfile_st *h; + if (_pt_sys_loglock == NULL) { + InitializeCriticalSection(&_st_sys_loglock); + _pt_sys_loglock = &_st_sys_loglock; + } GetLocalTime(&sysTime); if (!szPath) { if (GetSystemDirectoryW(sPath, MAX_PATH) == 0) @@ -304,6 +309,7 @@ apxLogWrite( } if (dwLevel < lf->dwLogLevel) return 0; + APX_LOGENTER(); if (f && (lf->dwLogLevel == APXLOG_LEVEL_DEBUG || dwLevel == APXLOG_LEVEL_ERROR)) { f = (szFile + lstrlenA(szFile) - 1); while(f != szFile && '\\' != *f && '/' != *f) @@ -389,6 +395,7 @@ apxLogWrite( } #endif } + APX_LOGLEAVE(); /* Restore the last Error code */ SetLastError(err); if (szFormat && err != 0 && dwLevel == APXLOG_LEVEL_ERROR) {