Jetty 9.3.8.v20160314 running on AWS EC2 Linux machine with Java 1.8.0_51 has two web apps under two different dir+context.xml - webapps/app1 and webapps/app2 with an empty webapps/ROOT directory.
I'm trying to get each webapp to have a separate log with contextPath in its name.
Each app has the following webapps/appX.xml context defined -
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/appX</Set>
<Set name="war">
<SystemProperty name="jetty.home" default="."/>/webapps/appX
</Set>
</Configure>
Followed Example: Centralized Logging with Logback and installed webapp-logging module, app is using slf4j Logger and resources/logback.xml is -
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %t %c{0} [%p] %m%n</pattern>
</encoder>
</appender>
<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>contextPath</key>
<defaultValue>unknown</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${contextPath}" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${jetty.home}/logs/${contextPath}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${contextPath}_%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %t %c{0} [%p] %m%n</pattern>
</encoder>
<append>true</append>
</appender>
</sift>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="SIFT"/>
</root>
</configuration>
But it all goes to unknown.log. Using servername instead works well and creates separate file for each domain being used to access the server.
So it would seem that contextPath isn't properly assigned by ContextLogHandler.
Why is it empty?
Related
I have configured OIDC authentication (external OP) with WAS Liberty Profile version WebSphere Application Server 21.0.0.7/wlp-1.0.54.cl210720210629-1900.
While testing, the OIDC authentication is successful and I see the following cookies set by WAS on my browser:
JSESSIONID
WASReqURLOidcp1059877004
WASReqURLOidcp825245628
WAS_n1263819336
WAS_n1832376351
WAS_p2129763847
WASOidcStaten765589445
WASOidcCode
I do see these messages in my messages.log during server startup:
0000003b com.ibm.ws.security.token.ltpa.LTPAKeyInfoManager I CWWKS4103I: Creating the LTPA keys. This may take a few seconds.
0000003b com.ibm.ws.security.token.ltpa.LTPAKeyInfoManager A CWWKS4104A: LTPA keys created in 0.337 seconds. LTPA key file: jv-ltpa.keys
0000003b com.ibm.ws.security.token.ltpa.internal.LTPAKeyCreateTask I CWWKS4105I: LTPA configuration is ready after 0.341 seconds.
Also, in my server.xml I have NOT explicitly disabled LTPA token or cookie generation.
disableLtpaCookie="false"
Why isn't there an LTPA cookie being set in my browser?
Here is my server.xml
<?xml version="1.0" encoding="UTF-8"?>
<server description="Default Server">
<!-- Enable features -->
<featureManager>
<feature>javaee-8.0</feature>
<feature>microProfile-3.0</feature>
<feature>adminCenter-1.0</feature>
<feature>appSecurity-2.0</feature>
<feature>openidConnectClient-1.0</feature>
<feature>transportSecurity-1.0</feature>
</featureManager>
<openidConnectClient id="oidcBridge" clientId="removed"
clientSecret="removed"
discoveryEndpointUrl="https://my-op.com/.well-known/openid-configuration" signatureAlgorithm="RS256"
jwkEndpointUrl="https://my-op.com/.well-known/jwks.json" disableLtpaCookie="false"
allowDefaultSsoCookieName="true">
</openidConnectClient>
<basicRegistry id="basic">
<user name="admin" password="admin" />
<user name="user1" password="user1" />
<user name="user2" password="user2" />
<group name="users">
<member name="user1" />
<member name="user2" />
</group>
</basicRegistry>
<administrator-role>
<user>admin</user>
</administrator-role>
<!-- To allow access to this server from a remote client host="*" has been added to the following element -->
<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443" />
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true" />
<keyStore id="defaultKeyStore" password="removed" location="${server.config.dir}/jv-trust.p12" type="PKCS12" />
<ltpa keysFileName="jv-ltpa.keys" keysPassword="removed" expiration="1200" />
<webAppSecurity singleSignonEnabled="true" ssoDomainNames="app1.com" allowFailOverToBasicAuth="true"
ssoRequiresSSL="false" />
<application context-root="snoop" id="DefaultApplication"
location="${server.config.dir}/apps/DefaultApplication.ear" name="DefaultApplication" type="ear">
<application-bnd>
<security-role name="All Role">
<special-subject type="ALL_AUTHENTICATED_USERS" />
</security-role>
</application-bnd>
</application>
</server>
I have an application on spring boot which is running on JBoss EAP 7.2 server and the application is deployed as a WAR file, all my applications logs are getting to the server.log and when I check the cloud watch logs its just printing the STDOUT's and not the one which is parameterized (log.debug or log.info). My application server is in the ECS container and I am really missing out on the connection between the Jboss server.log to AWS. Can someone help me out with this All my parameterized logs (log.debug) must be printed in the AWS cloud watch? Are there any third-party tools or there are configs changes which are needed to be made?
This is how my logging Subsystem looks like <subsystem xmlns="urn:jboss:domain:logging:6.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
</subsystem>
I'm using Habitat Sitecore. It comes with a bunch of foundation and feature projects. One of the feature projects is Sitecore.Feature.ActiveDirectory.
I'm trying to configure domains from patch files. It is outlined by Kam in this blog.
In the /App_config/Include/Feature/Feature.ActiveDirectory.config, I added the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<switchingProviders>
<membership>
<provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
</membership>
<roleManager>
<provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
</roleManager>
</switchingProviders>
<domainManager>
<domains>
<domain id="ad" type="Sitecore.Security.Domains.Domain, Sitecore.Kernel" patch:after="domain[#id='default']">
<param desc="name">$(id)</param>
<ensureAnonymousUser>false</ensureAnonymousUser>
<locallyManaged>false</locallyManaged>
<isDefault>false</isDefault>
</domain>
</domains>
</domainManager>
</sitecore>
</configuration>
However, I get the following Exception:
A domain specified in the Sitecore.Security.SwitchingRoleProvider provider/domain map could not be found. Domain name: ad
in
<add name="switcher" type="Sitecore.Security.SwitchingRoleProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/roleManager" />
What am I doing wrong?
Domains must be added directly to to Domains.config, located in App_Config\Security. It is not able to be patched. Make it part of your build train.
The question is specific to WebJobs. I've been thru the steps to configure logging to my Azure WebSite (sry...Azure AppService WebSite - sheese with the name changes already) and am now trying to iron everything out for WebJobs running beneath the same.
I'm logging to both a RollingFile and to the Ado.net appender - for sake of brevity pasting config only for the File - neither of the 2 work so gotta be a problem common at the core.
The sub-directory specified in the config exists but files are not being created within. The same configs are working for the host WebSite but WJs fail to log. Anywhere I can look for error messages or otherwise troubleshoot this?
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="D:/home/site/wwwroot/App_Data/Logs/AccountMaintenance/log4net_%date{yyyyMMdd}.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger %property – %message%newline" />
</layout>
</appender>
Shortly after posting this question I found a typo / syntax error in web.config file and my expected functionality returned.
Just for the record - here's a screenshot
I have implemented a web services using JaxWS-Spring. I would like to log the XML being received. I have tried various attempts, among which to add the proper categories to my log4j.properties file and using interceptors. However I have always failed for one reason or another (logging seems to be ignored - adding interceptors to my application context gives other issues).
The following snippets from my project :
PS: I am using Spring 2.5.6
web.xml
<servlet>
<servlet-name>jaxws-servlet</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Mapping to redirect all requests from 'FaxWebService' to jaxws-servlet. -->
<servlet-mapping>
<servlet-name>jaxws-servlet</servlet-name>
<url-pattern>/FaxWebService</url-pattern>
</servlet-mapping>
applicationContext.xml
<!-- Bind the URL FaxWebService to our bean FaxWebService. -->
<wss:binding url="/FaxWebService">
<wss:service>
<ws:service bean="#faxWebService"/>
</wss:service>
</wss:binding>
<!-- Bean responsible of taking care of the webservice. -->
<bean id="faxWebService" class="com.connexo.icubeplus3.dispatcher.webservices.FaxWebService"
scope="singleton">
<property name="dummyMode" value="${fax.dummy.mode}"/>
</bean>
I doubt this has anything to do with Spring WS to be honest.
If you want to log the incoming messages in Spring WS, you want to raise the logging level for org.springframework.ws.client.MessageTracing.sent and org.springframework.ws.client.MessageTracing.received to TRACE. For example, in log4j config:
<logger name="org.springframework.ws.client.MessageTracing.sent">
<level value="TRACE" />
<appender-ref ref="stdout" />
</logger>
<logger name="org.springframework.ws.client.MessageTracing.received">
<level value="TRACE" />
<appender-ref ref="stdout" />
</logger>
You will have to write a handler to log it. There are various examples in the web, like http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv_adv_rpc/handlers.html