Is there any way to log in a file like laravel?


I am trying to find a way to log like laravel. In laravel we log like this
\Log::info(‘something…’) and it’s stored in a log file. Is there anything like this in adonis.js?
Thank you.


Hi Hkmsadek :wave: .

In fact, there is.

First you need to set in config/app.js how it should be logged, e.g. file or the database.

after, you smily do:

const Logger = use('Logger')'Something... ');  

I found the doc:



if I use default settings in app.js as it is, then where it will save the log data? I couldn’t find it anywhere in my project. Where it saves?


console output, I think.


Hey @hkmsadek
It saves it in the console output, but if you want to store it in an easily accessible log file, you can do so by using file as transport in config/app.js

logger: {
  transport: 'file',
  console: {
    driver: 'console'
  file: {
    driver: 'file',
    filename: 'adonis.log'

The filename can be a relative path to the file you want to save the logs to.


Thanks it solved my problem :slight_smile: