You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Sean E. Covel (JIRA)" <ji...@apache.org> on 2018/07/15 20:26:00 UTC
[jira] [Created] (LOG4NET-604) UdpAppender does not resolve
environment variables .Net Core
Sean E. Covel created LOG4NET-604:
-------------------------------------
Summary: UdpAppender does not resolve environment variables .Net Core
Key: LOG4NET-604
URL: https://issues.apache.org/jira/browse/LOG4NET-604
Project: Log4net
Issue Type: Bug
Components: Appenders
Affects Versions: 2.0.8
Environment: Asp.Net Core 2.1. Windows 7, MacOs 10.12.6
Reporter: Sean E. Covel
I have a UdpAppender defined in a .Net Framework 4.5.2 and a .Net Standard (Asp.Net Core 2.1) project.
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
<remoteAddress value="${LOGSERVER_HOST}" />
<remotePort value="${LOGSERVER_PORT}" />
<layout type="log4net.Layout.PatternLayout, log4net">
<conversionPattern value="%d\{yyyy-MM-dd'T'HH:mm:ss.fff'Z'} %-5p [%property\{server_name} %property\{service_name} %property\{service_port} %property\{CorrelationId}][%t] %c\{5}:%L - %m%n"/>
</layout>
</appender>
On .Net 4.5.2 the environment variable LOGSERVER_HOST and LOGSERVER_PORT are read and used by the appender.
In .Net Standard I get the following error:
log4net: Loading Appender [UdpAppender] type: [log4net.Appender.UdpAppender]
log4net:ERROR Could not create Appender [UdpAppender] of type [log4net.Appender.UdpAppender]. Reported error follows.
log4net.Util.TypeConverters.ConversionNotSupportedException: Cannot convert from type [System.String] value [${LOGSERVER_HOST}] to type
[System.Net.IPAddress] ---> System.Net.Sockets.SocketException: No such host is known
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.ResolveCallback(Object context)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
at System.Net.Dns.EndGetHostEntry(IAsyncResult asyncResult)
at System.Net.Dns.<>c.<GetHostEntryAsync>b__27_1(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Bool
ean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at log4net.Util.TypeConverters.IPAddressConverter.ConvertFrom(Object source)
--- End of inner exception stack trace ---
at log4net.Util.TypeConverters.IPAddressConverter.ConvertFrom(Object source)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.SetParameter(XmlElement element, Object target)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
log4net:ERROR Appender named [UdpAppender] not found.
I have run the project on Windows 7 and MacOs 10.12.6. The only way to get the UdpAppender to work on .Net Core is to hard-code the address and port in the xml configuration.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)