title: How to provide the -Dlogback.configurationFile=./logback.xml option in nodejs spawn method
body: <p>I have angular2-node.js application. I am executing a jar file through the node server.</p>
  
  <p>Jar execution is happening fine but it's using the logback.xml present in the jar file.</p>
  
  <p>Node js code:</p>
  
  <pre><code>app.get('/report/:parameter1/:parameter2', function(req, res) {
  
  var fileName = path.join(__dirname, '..', 'javaFile', 'xyz.jar');
  
  spawn('/usr/bin/java', ['-jar ', fileName, parameter1 , parameter2, '&amp;'],{
                                              stdio : ['ignore', out, err],
                              detached : true }).unref();
  
  data = '{response: Success}';
  res.status(200).json(data);
  res.end();
  });
  </code></pre>
  
  <p>I want to refer the different logback.xml file for jar execution while running the jar from UI. So, i tried the below code:</p>
  
  <pre><code>spawn('/usr/bin/java', ['-jar -Dlogback.configurationFile=./logback.xml', fileName, cacheName , cacheType, '&amp;'],{
                                              stdio : ['ignore', out, err],
                              detached : true }).unref();
  </code></pre>
  
  <p>But, it also didn't work and throw the below error:</p>
  
  <pre><code>Unrecognized option: -jar -Dlogback.configurationFile=./logback.xml
  Error: Could not create the Java Virtual Machine.
  Error: A fatal exception has occurred. Program will exit.
  </code></pre>
  
  <p>I am new to node js. I searched the web but couldn't get an answer.</p>
  
  <p>Is there any way to provide the logback.xml file dynamically in node.js code something like we do in shell script like below:    </p>
  
  <pre><code>nohup java -jar -Dlogback.configurationFile=./logback.xml xyz.jar
  </code></pre>
  
  <p>Can anyone provide any solution for this.</p>