LoggerImpl Handler: Error creating native log file.
See original GitHub issueDescribe the bug When starting up my .NET 5 project, I receive the following error.
LoggerImpl Handler: Error creating native log file.
To Reproduce Steps to reproduce the behavior:
- Created a brand new .NET 5 Console Application
- Added dockerfile with the following datadog information per the documentation.
RUN curl -LO https://github.com/DataDog/dd-trace-dotnet/releases/download/v1.28.2/datadog-dotnet-apm_1.28.2_amd64.deb
RUN dpkg -i ./datadog-dotnet-apm_1.28.2_amd64.deb
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
Expected behavior I expected it to start up without a problem.
Runtime environment (please complete the following information):
- Instrumentation mode: Automatic
- Tracer version: 1.28.2
- OS: Linux
- CLR: .NET 5
Additional context I’m running this is a linux docker container using the .NET 5 runtime.
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
Workaround If I add the trace log path environment variable and set it to the default datadog trace location, it works fine.
Here’s a link to a github project with the example. https://github.com/jrmccannon/datadog-1.28.2-test
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Serilog does not create log files
and the Handle method, which is located in the MaterialCommandHandler class, in which I want to write something into the log file
Read more >Error creating native log file message logged when no ...
When setting up DataDog with Serilog in .Net an error is thrown an every deployment when no File sinks are registered with Serilog....
Read more >Sink is not creating Logger file on .Net Core · Issue #75
When i tried to create logger using following code: var log = new LoggerConfiguration() .WriteTo.
Read more >Logging configuration
Quarkus includes several different log handlers: console, file, and syslog. The featured examples use com.example as a logging category. Console log handler.
Read more >Serilog Tutorial for .NET Logging: 16 Best Practices and Tips
Serilog makes it easy to record custom object properties and output your logs to JSON. Read this Serilog tutorial for best practices and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jrmccannon, thanks for reaching out.
I think you’re missing a line in your Dockerfile that runs the script (included in the deb file) that creates the log path and updates permissions (as described in the docs). For example, you should have something like:
This creates the default log directory (
/var/log/datadog/dotnet
) and adds permissions to write to the directory, alternatively, you can set the log path to an existing directory usingDD_TRACE_LOG_DIRECTORY
as you mentioned.The behaviour changed in this PR to print to stderr when we can’t write logs. We will revert that behaviour so that we don’t print to stderr on startup, but you will still want to create the log directory nevertheless 🙂
Hi @lucianoeger, yes, the solution will be the same - either create the default log path at
/var/log/datadog/dotnet
and ensure it is writeable (the easiest way is by running thecreateLogPath.sh
included in the linux packages) or set a different (existing) directory using theDD_TRACE_LOG_DIRECTORY
environment variable. We have merged a fix for the issue, which should be included in the next release, but we advise you take the above steps regardless 🙂