View and Manage Node.js Logs from cPanel File Manager

View and Manage Node.js Logs from cPanel File Manager

View and Manage Node.js Logs from cPanel File Manager

View and Manage Node.js Logs from cPanel File Manager

Monitor, troubleshoot, and manage your Node.js application logs easily through cPanel’s File Manager.

Why Monitor Node.js Logs?

Logs provide valuable insights into your application’s performance, errors, and user activity. Regularly checking your logs helps you quickly identify and fix issues.

Prerequisites

  • Node.js application hosted on cPanel (Hiverift or similar)
  • Access to your cPanel dashboard
  • Basic familiarity with Node.js app structure

Step 1: Log into cPanel

Open your web browser and navigate to https://yourdomain.com/cpanel. Enter your cPanel username and password to log in.

Step 2: Locate Your Node.js Application Directory

In the cPanel dashboard, open File Manager. Navigate to the folder where your Node.js app files reside. This is usually inside the home/username directory or a subfolder like nodejsapp.

Step 3: Find Your Log Files

Node.js apps typically generate logs in these common ways:

  • Custom Log Files: Defined in your app code using console.log() or logging libraries like winston, saved to a file like app.log or error.log.
  • Default Error Logs: cPanel may store error logs for your app, often accessible via Errors or Raw Access Logs in cPanel.

Step 4: Open and View Log Files

  1. In File Manager, locate your log files, for example, logs/app.log or logs/error.log.
  2. Select the log file and click View or Edit to open it in the built-in text editor.
  3. Review the logs for errors, warnings, or info messages.

Step 5: Manage Your Logs

  • Download: To keep a backup, right-click the log file and select Download.
  • Clear Logs: To free up space, open the log file in edit mode, delete the contents, and save the empty file.
  • Rotate Logs: For large apps, implement log rotation in your Node.js app or via cron jobs to archive logs periodically.

Step 6: Use cPanel’s Error Logs for Quick Troubleshooting

Besides custom logs, you can also check:

  • Errors Section: In cPanel, click on Errors to see recent server and app errors.
  • Raw Access Logs: Provides detailed access logs useful for debugging traffic and request issues.
Tip: Configure your Node.js app to log both to console and files for easier troubleshooting in cPanel.

Example: Simple File Logging in Node.js

const fs = require('fs');
const logStream = fs.createWriteStream('./logs/app.log', { flags: 'a' });

function log(message) {
  const timestamp = new Date().toISOString();
  logStream.write(`[${timestamp}] ${message}\n`);
}

// Usage
log('Server started successfully');
log('Received a request on /api/data');

Summary

Using cPanel’s File Manager to view and manage your Node.js logs is a simple yet powerful way to keep your applications healthy and responsive. Regular log monitoring combined with effective log management practices ensures your app runs smoothly.

For more help, contact dev@hiverift.com.

© 2025 Hiverift. All rights reserved.

Post Your Comment

Build Your Website with HiveRift

From professional business to enterprise, we’ve got you covered!

©2025, Hosting. All Rights Reserved by KhatuShyam Technologies

HiveRift
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.