✅ Serilog does not write logs to file
I have tried to configure it on the appsettings to write file but it doesnt
75 Replies
and the included packages are
how are you configuring serilog in the code
at first sight config seems alright
except maybe pathFormat which i don't know where the hell that would point at
like maybe "folder\file.txt" could be ok, but starting with \ is probably not
even .\file.txt should be ok
I am using
will it create the folder if it doesnt exist?
because the folder does not exist
the console works
in my experience it does create the folder
"pathFormat": "./Employeeslog-{Date}.txt",
like that?
is this win, linux, osx?
it will be on linux probably
my pc is windows
that's why
using a env variable would be cool
how do you replace a env variable in serilog
%varname%
or ${varname}
apparently it's %var%
although i've never used that
so
%var%/mypath/myfile.txt
what am i doing wrong?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
i will do that instead then
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
that is for debugging only
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
they are meant ot include it in the configuration
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
these using
probably to include it in the WriteTo
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
why?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I referenced
it is the damn path thign or the fomratting
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
they had done it before
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I dont konw why they changed their ways
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
now you us ea Static class
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
i dont know why they changed that because in 4.0 it worked with microsoft logger
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Log is their own
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
mm
i am using it to ensure it is reading the log from my string
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
so I dont get that my code is not calling serilog method for no reason
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
how?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
TeBeCo
Quoted by
<@689473681302224947> from #Serilog does not write logs to file (click here)
React with ❌ to remove this embed.
makes sense
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
those are other sinks
i dont think they belong to Serilog
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
ops yeah but they are their own package I mean
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yes i know
i forgot the terminology
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
@TeBeClone one question
can i override the reader form serilog
so I can see what it isreading
for the path?
or know
what is reading for the file path
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
maybe it is not recognizing the path
i mean the one that reads the configuration from appsettings
so I can see what it is receiving
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
well this is like a blackbox with the json
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
it is within the container
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
so there are like 300 services
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
lol
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
so you telll me every logger that is created is replaced by theirs at the IloggerFactory they impelement
i didnt knwo that
good think i only do ILogger DI with generic
and I dont use the ILoggerProvider/Factory
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
as far the DI works fine I am fine I dont plan using a LoggerFactory if it was some other dependency package that required one I Would be worried
but I am fine using whatever they inject lol
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
what kind of enricher do you need to make one your own
in what case scenario do you need one?
Stack Overflow
Serilog - how to customize date in rolling file name?
In Serilog, you can easily enable rolling log files:
Log.Logger = new LoggerConfiguration()
.WriteTo.File("log-.txt", rollingInterval: RollingInterval.Day)
.CreateLogger();
This will crea...
how do I place the Date on the file
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
like this?
makes sense
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
how do i assign the property into the config for serilog then?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
7
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
ok
let me join