Knowledgebase

Node.js Set Console Log Location

By default there is no console location defined for Node.js applications. You can define one by setting an environmental variable LSNODE_CONSOLE_LOG and the desired location of your log file. To set an environmental variable you navigate to your Node.js application list and click edit on the desired application. On this page there will be an option to define environment variables:

You will add the following:

Name: LSNODE_CONSOLE_LOG
Value: /home/username/pathtoapp/console.log

Adjust the value according to the desired location of your console.log. After you've set a value save your Node.js application and any further console activity will be written to the log file. You can test this by inserting the following code:

console.log('Testing logging');

For more advanced users you can also define the environment variable within the .htaccess file of the document root of your Node.js application. The format of that would be as follows:

<IfModule Litespeed>
SetEnv LSNODE_CONSOLE_LOG /home/username/nodeapp/console.log
</IfModule>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Available Node.js Versions

We recommended all Node.js applications are created using our Setup Node.js Application...

Available Python Versions

We recommended all Python applications are created using our Setup Python Application interface....

Available Ruby Versions

We recommended all Ruby applications are created using our Setup Ruby Application interface. If...

Default permissions on folders and PHP files.

We currently run Litespeed Web Server which runs PHP as the user so files and folders should...

Do you support Ruby on Rails?

Yes we support Ruby On Rails and you can install and utilize many different versions of Ruby and...