How can we load logback.xml via jvm argument if this is not present in project classpath?
I'm using
-Dlogback.configuration=file:C:\logbacs\logback.xml
but this is not working.
I found the solution
-Dlogging.config="C:\logbacs\logback.xml"
is working fine for me.
Updated because the previous answer was obsolete
If you're not using SpringBoot the above won't work.
I'm using the ch.qos.logback.logback-classic library, and in this case the solution is
-Dlogback.configurationFile=file:/app/logback.xml
I've found this property in ch.qos.logback.classic.util.ContextInitializer:
final public static String CONFIG_FILE_PROPERTY = "logback.configurationFile"
The original answer to this question doesn't appear to be working anymore as it produces this warning instead:
o.s.b.l.logback.LogbackLoggingSystem : Ignoring 'logback.configurationFile' system property. Please use 'logging.config' instead.
Therefore, you would want to use something like this:
-Dlogging.config="C:\logbacs\logback.xml"
For me it works only with this property:
-Dconfig.dir= "YOUR PATH TO CONFIG FILE"
As per https://logback.qos.ch/manual/configuration.html, use -Dlogback.configurationFile
java -Dlogback.configurationFile=/path/to/config.xml chapters.configuration.MyApp1
Related
I am trying to setup SmartEdit in our spartacusstorefront. We use a customized extension which is based on spartacussampledataaddon.
Followed in the instructions in: https://sap.github.io/spartacus-docs/smartEdit-setup-instructions-for-spartacus/
But in smartedit, we get this error:
No component factory found for SmarteditElementComponent. Did you add it to #NgModule.entryComponents
Any pointers
This error actually does not relate to Spartacus, it's a SmartEdit edit error instead. The SmartEdit team is not watching this channel, so Id recommend to use existing help/support/consultant channels to fix your issue.
I have using the following parameters in wrapper.conf in my JBoss_EAP_7.1.5 :
wrapper.java.additional.1=-Dprogram.name=JBoss_EAP_7.1.5
wrapper.java.additional.2=-Dsun.rmi.dgc.client.gcInterval=3600000
wrapper.java.additional.3=-Dsun.rmi.dgc.server.gcInterval=3600000
wrapper.java.additional.4=-Xms5G
wrapper.java.additional.5=-Xmx5G
wrapper.java.additional.6=-XX:MaxPermSize=512m
wrapper.java.additional.7=-Dsun.lang.ClassLoader.allowArraySyntax=true
wrapper.java.additional.8=-Djava.net.preferIPv4Stack=true
wrapper.java.additional.9=-server
wrapper.java.additional.10=-XX:+UseParNewGC
wrapper.java.additional.11=-XX:NewRatio=10
wrapper.java.additional.12=-Djboss.platform.mbeanserver
wrapper.java.additional.13=-Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl
#Below parameter is added to support emptySessionPath in mod_jk connector
wrapper.java.additional.14=-Dorg.apache.catalina.connector.Request.SESSION_ID_CHECK=true
#Below parameter is added to support acceptCount in JBoss EAP
wrapper.java.additional.15=-Dorg.apache.tomcat.util.net.WAITFORWORKER=true
wrapper.java.additional.16=-Dorg.jboss.resolver.warning=true
wrapper.java.additional.17=-Djboss.modules.system.pkgs=org.jboss.byteman,org.aspectj
wrapper.java.additional.18=-Djava.awt.headless=true
wrapper.java.additional.19=-Dorg.jboss.boot.log.file=..\standalone\log\boot.log
wrapper.java.additional.20=-Dlogging.configuration=file:..\standalone\configuration\logging.properties
wrapper.java.additional.21=-Dorg.jboss.logmanager.nocolor=true
wrapper.java.additional.22=-Djava.ext.dirs=..\jdk\jre\lib\ext;..\modules\org\aspectj\main
wrapper.java.additional.23=-javaagent:..\modules\org\aspectj\main\aspectjweaver-1.8.9.jar
wrapper.java.additional.24=-Dorg.aspectj.tracing.enabled=false
wrapper.java.additional.25=-Dorg.aspectj.tracing.factory=default
wrapper.java.additional.26=-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=*
wrapper.java.additional.27=-XX:+PrintGCDetails
wrapper.java.additional.28=-XX:+PrintGCTimeStamps
wrapper.java.additional.29=-Xloggc:C://xxxx_gc.log
wrapper.java.additional.30=-XX:PermSize=512m
wrapper.java.additional.31=-XX:ReservedCodeCacheSize=128m
wrapper.java.additional.32=-XX:+CMSClassUnloadingEnabled
wrapper.java.additional.33=-XX:+UseConcMarkSweepGC
wrapper.java.additional.34=-XX:CMSInitiatingOccupancyFraction=85
wrapper.java.additional.35=-XX:+UseCMSInitiatingOccupancyOnly
wrapper.java.additional.36=-XX:+ExplicitGCInvokesConcurrent
wrapper.java.additional.37=-XX:CMSIncrementalSafetyFactor=20
wrapper.java.additional.38=-XX:+UseLargePages
wrapper.java.additional.39=-XX:-UseParallelGC
wrapper.java.additional.40=-XX:+CMSConcurrentMTEnabled
wrapper.java.additional.41=-XX:ConcGCThreads=4
wrapper.java.additional.42=-XX:ParallelGCThreads=12
wrapper.java.additional.43=-XX:MaxTenuringThreshold=10
wrapper.java.additional.44=-XX:InitialTenuringThreshold=10
So now I am trying to find the use of each parameter and if they deprecated or not.
Is there any documentation for this or anyone can hep me in this?
Here you have a great guide to what you need. There is A LOT of information, so you have to take a look and do some research, and here you have a list of properties.
Maybe all the parameters you need will not be available, but you can find the great part of them. Here is an advanced list, you can try to find more parameters.
As #apangin indicated here is a list of properties and their availability, or if they are deprecated, obsoleted or expired, version by version.
Finally, here is an Oracle guide.
Last but not least, if all of above is not enough, you can look here, where you can type and search what you need and even get a good example
During veracode scan i got CWE 73 issue in my result. Can someone suggest me how to fix this solution for the below coding scenario?
The existing solutions provide is not working,also i would like to know any ESAPI properties can be used to get rid of this issue?
try
{
String serviceFile = System.getProperty("PROP", "");
logger.info("service A", "Loading service file [" + serviceFile+ "].");//Security Issue CWE 73 Occurs in this line
}
There are several solutions for it:
Validate with a whitelist but use the input from the entry point As
we mentioned at Use a list of hardcoded values.
Validate with a simple regular expression whitelist
Canonicalise the input and validate the path
I used the first and second solutions and work fine.
More info at: https://community.veracode.com/s/article/how-do-i-fix-cwe-73-external-control-of-file-name-or-path-in-java
this document provides detailed information on recommended remedies any explicit custom solution. In my case, I tried whitelisting or blacklisting patterns in the provided method parameters however that still did not resolve CWE-73 risk. I think thats expected and the document does state this:
A static engine is limited in what it can detect. It can only scan your code, it won’t actually run your code (unlike Dynamic Scanning). So it won’t pick up any custom validation (if conditions, regular expressions, etc.). But that doesn’t mean that this is not a perfectly valid solution that removes the risk!
I tried my custom blacklisted pattern based solution and annotated the method with FilePathCleanser as documented in here and it resolved CWE-73 and veracode no longer shows that as a risk.
Try to validate this PROP string with Recommended OWASP ESAPI Validator methods, like below.
Example:
String PropParam= ESAPI.validator().getValidInput("",System.getProperty("PROP", ""),"FileRegex",false);
FileRegex is the Regular Expression against which PROP string i.e. path of the file is getting validated.
Define FileRegex = ^(.+)\/([^\/]+)$ in Validator.properties.
I am trying to allow slashes in my Path:
#Path("/user/{login}/points")
by using this solution so it becomes:
#Path("/user/{login : .+}/points")
but it will not work anytime a user names their account e.g
test/points
because only "test" will be passed. It works fine with test/test or any other login not ending with /points.
I have no idea how should I solve this. I need it as String param and it's set by user.
Thanks for any help!
Looks like I found the solution myself with a little help of #YCF_L (sadly he deleted his comment).
Solution:
#Path("/user/{login : .+(?=\\/points)}")
I want to get what the name of my instance is from within the app.
THANKS
It looks like you can use SystemProperty.applicationId.get(), see here:
http://code.google.com/appengine/docs/java/runtime.html#The_Environment
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/utils/SystemProperty.html