newrelic-dotnet-agent icon indicating copy to clipboard operation
newrelic-dotnet-agent copied to clipboard

LogException Error

Open ismkdc opened this issue 4 years ago • 4 comments
trafficstars

Hello, I was installed my project agent and its working fine. But i had an exception when starting application on docker

web_1            | log4net:ERROR You have tried to set a null level to root.
web_1            | log4net.Core.LogException: Exception of type 'log4net.Core.LogException' was thrown.

My Docker File

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build-env

WORKDIR /app
COPY . .

RUN dotnet restore
RUN dotnet build -c Release -o /out
RUN dotnet publish -c Release -o /out

# Runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine

WORKDIR /app
COPY --from=build-env /out .

#for timezone
RUN apk update && \
    apk add --no-cache tzdata icu-libs

#set env
ENV TZ=Europe/Istanbul
ENV LANG tr_TR.UTF-8
ENV LANGUAGE ${LANG}
ENV LC_ALL ${LANG}
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

# Enable the agent
RUN  mkdir /usr/local/newrelic-netcore20-agent \
&& cd /usr/local \
&& export NEW_RELIC_DOWNLOAD_URI=https://download.newrelic.com/$(wget -qO - "https://nr-downloads-main.s3.amazonaws.com/?delimiter=/&prefix=dot_net_agent/latest_release/newrelic-netcore20-agent" | grep -E -o 'dot_net_agent/latest_release/newrelic-netcore20-agent_[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}_amd64\.tar\.gz') \
&& echo "Downloading: $NEW_RELIC_DOWNLOAD_URI into $(pwd)" \
&& wget -O - "$NEW_RELIC_DOWNLOAD_URI" | gzip -dc | tar xf -

# Enable the agent
ENV CORECLR_ENABLE_PROFILING=1 \
CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A} \
CORECLR_NEWRELIC_HOME=/usr/local/newrelic-netcore20-agent \
CORECLR_PROFILER_PATH=/usr/local/newrelic-netcore20-agent/libNewRelicProfiler.so \
NEW_RELIC_LICENSE_KEY=xxxx(removed) \
NEW_RELIC_APP_NAME=xxxx(removed)

ENTRYPOINT dotnet ${DLL_NAME}.dll

ismkdc avatar Nov 19 '21 13:11 ismkdc

Hello @ismkdc, thanks for letting us know about this.

I just tried running the latest agent version (9.2.0) with a standard .NET MVC template app from the .NET 6.0 SDK docker image on Alpine. I was not able to reproduce this issue.

A couple questions:

  1. Do you also use log4net in your application?
  2. Could you attach/paste a copy of your newrelic.config file with any sensitive information (e.g. license key) removed?

Thanks.

nr-ahemsath avatar Nov 22 '21 17:11 nr-ahemsath

Hello, thx your quick reply.

1-) I am not using log4net library in my application 2-) I am not using newrelic.config ile as you can see first post my licence key and stuff in dockerfile env.

ismkdc avatar Nov 22 '21 18:11 ismkdc

@ismkdc : Okay, I had a little more time to try running a test app with your actual Dockerfile, and I am able to repro the issue (the two log4net error messages). Looking over your Dockerfile more carefully, I noticed the localization settings, and I did a quick test to see what would happen if I commented them out, e.g.:

# comment out localization settings
##set env
#ENV TZ=Europe/Istanbul
#ENV LANG tr_TR.UTF-8
#ENV LANGUAGE ${LANG}
#ENV LC_ALL ${LANG}
#ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

and that makes those errors go away. So, this appears to be related to localization somehow.

For what it's worth, it appears (with my simple MVC sample app, anyway) that the agent is working as expected even when the log4net errors occur; i.e. the app is reporting to New Relic and transaction data can be seen in the APM UI. Are you experiencing any other issues with New Relic and your application beyond the log4net errors?

nr-ahemsath avatar Nov 23 '21 14:11 nr-ahemsath

@ismkdc: checking in on this. Please let us know if you're having any problems with the New Relic .NET agent other seeing those log4net errors in the output from your docker container.

nr-ahemsath avatar Jan 03 '22 21:01 nr-ahemsath

https://issues.newrelic.com/browse/NEWRELIC-3607

We are closing this ticket since there wasn't a response to @nr-ahemsath comment above for a while. We believe the feature is functioning as expected. Please reopen the ticket if there are further details on reproducing the problem.

angelatan2 avatar Oct 03 '22 19:10 angelatan2