Hello all I'm trying to create a simple log that ...
# lucee
m
Hello all I'm trying to create a simple log that would just write some basic information to a log file but although I don't get any errors, when I execute the page that contains the log statement, nothing gets written to the log This is my log statement
<cflog file="updatecompany" application="no" text="User  logged on.">
I have created a log in the Lucee administrator called updatecompany and can see this log file in C:\lucee\tomcat\lucee-server\context\logs ..but its blank What am I missing ? Much appreciated
e
For starters, your complete code would help, as would the environment. The file should be something like hard file path or cfset someplacetostorelog and cfset filename such as <cflog file="c:\logs\loggyLog.log" output=#myLog# mode="append" ./>
m
@Evil Ware thanks. Tried that too but still nothing being written to the log file
e
First, what ever you are trying to log, you should be able to output it to the screen. If that actuallly works, then make sure your service running lucee has read write and or change permissions for the file you are changing,
👍 1
p
What is your log's Level set at in the Admin? Info will catch nearly all messages. Or if the level is error then you need to add
type="error"
to your tag.
g
if I may: You don't need a full path to your log. The filepath by default is the context of the web app - not the server's context. You may well have an empty file in the server context AND your code is working and your just not looking in the correct context (file path) for it. Off the top of my head it is... lucee/config/web/XXX/logs
d
@gavinbaumanis is steering you right in that the
lucee/config/web
is the correct path of where
<cflog />
files are written, which is why you are not seeing it in the
server
folder. Also, the log file is created automatically if it does not exist, so no need to create it.
q
And depending on the deployment and version (5 vs 6, docker vs. standalone vs commandbox vs. light, etc.), the file locations may be in different places. Linux based machines, it's easy to go in and do a
find / -name updatecompany.log -print
Windows, go to the root if your drives and do a
dir updatecompany.log /s /p
m
Thanks everyone and aplogies 🙏 - I found the issue ! I was looking for the log in the wrong log file for it 😱. I found it here and it is writing to it! Argggh silly me! Projectname\WEB-INF\lucee\logs
👍🏼 1