Logback file inclusion with a wildcard - log4j

We have multiple plugins added to our application. Each plugin comes with its own logback_plugin.xml configuration file. We have to maintain the same in a specific folder.
I can use the INCLUDE tag for inclusion of another configuration file from logback.xml file. Can we do it for multiple files, something like
<include file="src/main/resources/*.xml" />
than explicitly naming a file, So that all the files are included. I tried the same but it ended up in an IOException.

You can achieve the same result by nesting the tags.
I added the below include tag to the main logback.xml file
<include file="src/main/resources/plugins_logback.xml" />
Added file plugins_logback.xml at the above location which had an <included> element . All other plugins specific logback configuration files were included as a sub element as mentioned below.
<included>
<include file="src/main/resources/plugin1_logback.xml"/>
<include file="scr/main/resources/plugin2_logback.xml"/>
</included>
Logback configurator loads the entire configuration from all the files during startup.

Related

WinUI Using Merged Dictionary from a DLL

I have this requirement where I need to access a resource dictionary defined in a DLL in my project as a merged dictionary. The whole project is setup as a C++/WinRT xaml hosted MFC application. And the required ResourceDictionary is a part of another dll.
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="PathToDict/CommonDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
As shown here in the Source property, CommonDictionary.xaml exists as part of another projects binary(dll) and I need to merge that file to my project by specifying the a path to it.
I've already tried something like this although this works only for WPF;
<ResourceDictionary Source="pack://application:,,,/myNameSpace;component/CommonDictionary.xaml"/>
And also tried this after adding a reference to the project;
<ResourceDictionary Source="ms-appx:///MyNamespace/CommonDictionary.xaml"/>
None of these seem to work.
if your file in project directory, try to use
<ResourceDictionary Source="ms-appx:///CommonDictionary.xaml"/>
Generally, you can open any Page.g.i.cs file and see any string with Uri define. For example:
global::System.Uri resourceLocator = new global::System.Uri("ms-appx:///View/Page.xaml");

Change external annotations folder in Android Studio 2.2.3

I set the folder for external annotation once in my Android studio. Now, I wanted to change the folder location, following https://www.jetbrains.com/help/idea/2016.3/using-external-annotations.html#d2150916e113 guideline. However, there is no Paths tab...
Does anyone know how to do it? Any config file... whatever!
With reference to this, https://blog.jetbrains.com/idea/2008/02/external-annotations/ I also faced this problem that there is no Paths tab in the Annotations area in the module settings as mentioned in this page.
However, you can edit the .iml in your module folder or .iml in your project folder, depending on whether you want to have externally stored annotations for only a specific module or entire project.
The annotation-paths tag is the one you need to edit.
<annotation-paths>
<root url="file://$MODULE_DIR$" />
</annotation-paths>
I had this same problem, and the other answer didn't help me -- I couldn't find <annotation-paths> anywhere in an .iml file and couldn't find a part of the settings gui to change this.
I noticed that Android Studio would ask me to create a new directory tree for annotations from different libraries. So after hunting around, I found that in <project>/.idea/libraries/<libname>.xml there are <ANNOTATIONS> tags that can be changed.
For most libraries this worked, however I couldn't find any file or <ANNOTATIONS> for the actual classes in the Android SDK.
Android Studio saves it globally, if you want to change it or remove it, close your Android Studio and follow this:
You can search for annotationsPath in
C:\Users\ USER ACCOUNT NAME \.AndroidStudio3.0\config\options\jdk.table.xml
If using another Android Studio version, look for a similar folder.
Inside the jdk.table.xml file, look for it:
<annotationsPath>
<root type="composite">
<root type="simple" url="jar://$APPLICATION_HOME_DIR$/plugins/android/lib/androidAnnotations.jar!/" />
<root type="simple" url="file://..." />
</root>
</annotationsPath>
And change the url="file://... there, or delete the <root type="simple" url="file://..." /> line and Android Studio will ask again next time when needed.

Where to put custom RichFaces my.skin.properties file?

The docs say put it in META-INF/skins, but RichFaces doesn't find it there, or anywhere else I tried.
I use Tomcat with MyFaces 2 JSF and RichFaces 4 components
Update: I posted the Exception that Tomcat throws at http://paste.lisp.org/display/128193
Update 2: In response to BalusC's comments below, I established that specifying org.richfaces.SKIN in uppercase also doesn't help.
The community forums notes that the my.skin.properties file (note: pluralizing skin to skins--as in my.skins.properties--is incorrect) must be in WEB-INF/classes/META-INF/skins.
In NetBeans, for example, this can be accomplished as follows:
Switch to the Files tab.
Create a new directory at the same level as src and web called resources.
Create a sub-directory in resources called WEB-INF.
Copy my.skin.properties into resources/WEB-INF.
Update web.xml to contain:
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>my</param-value>
</context-param>
Note: Some places, including the formal documentation, refer to the skin param-name as org.richfaces.SKIN, which is incorrect. The param-name must be all lowercase.
Next:
Update build.xml to contain:
<target name="-post-dist">
<war destfile="${dist.war}" update="true">
<zipfileset dir="${basedir}/resources/WEB-INF" prefix="WEB-INF/classes" />
</war>
</target>
Press Shift+F11 to rebuild the application.
Verify that the archive (e.g., Project.war) contains the following file:
\Project.war\WEB-INF.classes\my.skin.properties
When deployed, the application should find the properties file.

Magento Content Block Question

Noob Question here. I have created and successfully added an additional Page Layout to the existing theme on a client's website.
I then checked what was going on in the content area and found that a file, named grouped.phtml was being called.
The Problem:
I want to duplicate that file and call it (for example) grouped2.phtml and add it to my custom page layout, while keeping the first file (grouped.phtml) alone. How do I do this? Thank you ahead of time.
Copy grouped.phtml from base/default/template/catalog/product/view/type/ to grouped2.phtml in the same directory of your theme. Edit it as you wish.
Open up layout/catalog.xml in your theme. Find the lines that say
<block type="catalog/product_view_type_grouped" name="product.info.grouped" as="product_type_data" template="catalog/product/view/type/grouped.phtml">
<block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra"/>
</block>
Duplicate those lines with your grouped2.phtml
done.
======EDIT===========
If you wish to retain the standard grouped.phtml as the default, but use your grouped2.phtml in some specific instances, you can make XML layout changes in the "Custom Layout Update" field on the Design tab of the specific products or categories in the Magento Admin. In that case, use the following XML:
<remove name="product.info.grouped"/>
<block type="catalog/product_view_type_grouped" name="product.info.alternative.grouped" as="product_type_data" template="catalog/product/view/type/grouped2.phtml">
<block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra"/>
</block>
Note that the inserted XML has a different name.

How do I filter overlayed WAR resources when building a WAR with Maven?

I have two WARS:
base-overlay
example-app
base-overlay has XML config files in src/main/webapp/WEB-INF/spring/*.xml. In those XML config files, I have parameters that need to be filtered when building the example-app WAR, which depends on base-overlay to be its overlay. For example, base-overlay/src/main/webapp/WEB-INF/spring/app-context.xml has ${data.url} in it. When packaging the example-app WAR, I've set the POM property <data.url>http://example.com:1234</data.url> to replace base-overlay's ${data.url}.
When I configure the maven-war-plugin to filter this file, I had to give it a directory of target/war/work/com.example/base-overlay/WEB-INF/spring just to find the app-config.xml file to filter before adding it to the newly packaged example-app WAR. This seems like a hack, and also doesn't work when testing with Jetty, as the WAR isn't created and filtered.
Furthermore, the POM's <build/> element has a <resources/> element, but I couldn't get that to work.
How do I filter the overlay resources when compiling?
To resolve this issue, I moved all XML resources (Spring) to the appropriate Maven resource directory ${basedir}\src\main\resources\ and then added that to the POM in the <build/> element like:
<resources>
<resource>
<directory>${basedir}/src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
I included the common XML resources that don't need to be filtered the in the base-overlay WAR. In each application that uses the base-overlay WAR, I added an XML file named filtered-resources.xml that is filtered each time the application WAR is packaged and assembled by Jetty.

Resources