Skip to content

Commit 7918aff

Browse files
saarnoldjmachowinski
authored andcommitted
log dir: added the possibility to manually set the default log dir in the spawner
If no log directory is set the bundle log dir will be used to be consistent with the current behavior.
1 parent d84d9d5 commit 7918aff

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/Spawner.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ void shutdownHandler(int signum, siginfo_t *info, void *data)
6969

7070
Spawner::Spawner()
7171
{
72-
//log dir always exists if requested from bundle
73-
logDir = Bundle::getInstance().getLogDirectory();
74-
7572
nameService = new CorbaNameService();
7673
nameService->connect();
7774

@@ -264,6 +261,12 @@ Spawner::ProcessHandle &Spawner::spawnTask(const std::string& cmp1, const std::s
264261

265262
Spawner::ProcessHandle& Spawner::spawnDeployment(Deployment* deployment, bool redirectOutput)
266263
{
264+
if(redirectOutput && logDir.empty())
265+
{
266+
//log dir always exists if requested from bundle
267+
logDir = Bundle::getInstance().getLogDirectory();
268+
}
269+
267270
ProcessHandle *handle = new ProcessHandle(deployment, redirectOutput, logDir);
268271

269272
handles.push_back(handle);
@@ -454,4 +457,8 @@ bool Spawner::isRunning(const Deployment* instance)
454457
return false;
455458
}
456459

460+
void Spawner::setLogDirectory(const std::string& log_folder)
461+
{
462+
logDir = log_folder;
463+
}
457464

src/Spawner.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ class Spawner : public boost::noncopyable
127127
* Returns, if the given instance of a deployment is running.
128128
* */
129129
bool isRunning(const Deployment *instance);
130+
131+
/**
132+
* Sets the default log directory.
133+
* If no log directory is set it will be determined using bundles.
134+
*/
135+
void setLogDirectory(const std::string& log_folder);
130136

131137
private:
132138

0 commit comments

Comments
 (0)