<p>You can do this with the Log To File helper, which provides a simple way for logging messages to a specific file: <a href="https://github.com/putyourlightson/craft-log-to-file" rel="nofollow noreferrer">https://github.com/putyourlightson/craft-log-to-file</a></p>
<p>This question has already been answered in detail at <a href="https://craftcms.stackexchange.com/questions/25427/craft-3-plugins-logging-in-a-separate-log-file">Craft 3 plugins - Logging in a separate *.log file</a></p>

CC BY-SA 4.0
2021-09-19T17:33:54.123Z
Thanks, in fact I tried to use the library but the log was never generated. I am probably using it wrong.

For instance:
``LogToFile :: info ($ message, 'my-plugin-handle');``

What is ``my-plugin-handle``? Because in my case I am not using a plugin, I am using a module.
So if my module is called: custommodule
it is
``LogToFile :: info ($ message, 'custom-module');``

Sorry for the questions but I did see the post but it was not clear to me where you indicate the new name of the .log

Thanks!
suhkha
CC BY-SA 4.0
2021-09-19T18:23:20.860Z
That can be anything, it will be used as the file name for the log file.
Ben Croker
CC BY-SA 4.0
2021-09-19T06:44:57.163Z
2021-09-19T06:44:57.163Z
Ben Croker
<p>I understand that Craft CMS generates a web.log file for you
but is there a way to do a custom.log?</p>
<p>I have a module and a controller where I want to send specific information from my controller to a custom.log but I can't find any documentation about it.</p>
<p>Thank you very much for your help.</p>

<logs>
Custom log file from module/controller
# Custom log file from module/controller

(Asked by: username_0 on 2021-09-18)

I understand that Craft CMS generates a web.log file for you
but is there a way to do a custom.log?

I have a module and a controller where I want to send specific information from my controller to a custom.log but I can't find any documentation about it.

Thank you very much for your help.

**Tags:** logs

---

## 1 answers

### Answer by username_1 on 2021-09-19. Score: 1

You can do this with the Log To File helper, which provides a simple way for logging messages to a specific file: <https://github.com/putyourlightson/craft-log-to-file>

This question has already been answered in detail at [Craft 3 plugins - Logging in a separate \*.log file](https://craftcms.stackexchange.com/questions/25427/craft-3-plugins-logging-in-a-separate-log-file)

> **Comments:**
> **username_0**: Thanks, in fact I tried to use the library but the log was never generated. I am probably using it wrong.  For instance: ``LogToFile :: info ($ message, 'my-plugin-handle');``  What is ``my-plugin-handle``? Because in my case I am not using a plugin, I am using a module. So if my module is called: custommodule it is ``LogToFile :: info ($ message, 'custom-module');``  Sorry for the questions but I did see the post but it was not clear to me where you indicate the new name of the .log  Thanks!  
> **username_1**: That can be anything, it will be used as the file name for the log file.  

---

