New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not work with PublishSingleFile in .net core 3.1 #4040
Comments
Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better! |
Have you configured <Content Include="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content> Also consider making use of |
There are same with
|
Guess you have to follow the trouble-shooting guide: https://github.com/NLog/NLog/wiki/Logging-troubleshooting Maybe jump directly to step 4 where the If your single-file-exe has embedded an "empty" |
Program.cs
This is NLog.Internal.txt.
But the log file is still not logged. |
Have 2 observations:
|
I don't quite understand what you mean.Do you mean I can not use |
Right now we are trying to use But it seems that you enable Can you check your code to see if there are other places where you call You are free to call |
Please try this code instead: public static void Main(string[] args) {
NLog.Common.InternalLogger.LogLevel = NLog.LogLevel.Debug;
NLog.Common.InternalLogger.LogToConsole = true;
NLog.Common.InternalLogger.LogFile = "C:\\Temp\\NLog.Internal.txt";
Logger logger = LogManager.GetLogger("foo");
logger.Info("Program started");
LogManager.LoadConfiguration("NLog.config"); // Explicit load of NLog.config to capture InternalLogger-details
CreateHostBuilder(args).Build().Run();
LogManager.Shutdown(); // Remember to flush
} |
Please add the requested info, so we could help you better! (This issue will be closed in 7 days) |
Hi! Thanks for reporting this feature/bug/question!
Please keep / fill in the relevant info from this template so that we can help you as best as possible.
QUESTIONS are preferred on StackOverflow. You could expect a faster response there (but do include all the info below). Use the tag "nlog" https://stackoverflow.com/questions/ask
For .NET Core users, please check the platform support: https://github.com/NLog/NLog/wiki/platform-support
NLog version: 4.9.2
Platform: .NET Core 3.1
Current NLog config (xml or C#, if relevant)
Program.cs
*.csproj
There is not any log in file and console.
If I remove
.UseNLog()
to use Microsoft default logger,It is OK to work.So I think it is a bug in NLog.What can I do for this?
The text was updated successfully, but these errors were encountered: