Skip to content

Commit 605982b

Browse files
committed
Instantiate parse command line before logger to use work_dir
1 parent d7cab18 commit 605982b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Agent/OCSInventory.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,18 @@ BOOL COCSInventoryApp::InitInstance()
126126
BOOL bWriteState = FALSE;
127127
CString csLabelText;
128128

129+
// Agent Configuration
130+
m_pConfig = getAgentConfig();
131+
132+
// Parse command line before instanciate logger
133+
BOOL bParseCommandLine = parseCommandLine();
134+
129135
// Logger
130136
m_pLogger = getOcsLogger();
131137
m_pLogger->setApplication( AfxGetAppName());
132138
m_pLogger->log( LOG_PRIORITY_NOTICE, _T( "=============================================================================="));
133139
m_pLogger->log( LOG_PRIORITY_NOTICE, _T( "Starting OCS Inventory Agent on %s."), cStartTime.Format( _T( "%#c")));
134140

135-
// Agent Configuration
136-
m_pConfig = getAgentConfig();
137-
138141
// Communication provider loader
139142
CComProvider *pProvider = getComServerProvider();
140143
CServerConfig *pServerConfig = NULL;
@@ -164,7 +167,7 @@ BOOL COCSInventoryApp::InitInstance()
164167
* Parse command line
165168
*
166169
****/
167-
if (!parseCommandLine())
170+
if (!bParseCommandLine)
168171
{
169172
m_pLogger->log(LOG_PRIORITY_ERROR, _T( "AGENT => Failed initializing using provided command line parameters <%s>"), m_lpCmdLine);
170173
m_nExitCode = OCS_APP_GENERIC_ERROR;

0 commit comments

Comments
 (0)