Log4j2 property file support for custom filters - log4j2

I am trying to use a custom filter using log4j2 in two ways below. Unfortunately I get invalid element or attribute 'filter' error. Is log4j2 xml needed for filters?
I tried with or without using package name in the filter none of which works
appender.custom.filter=com.test.util.CustomAppender
packages=com.test.util
appender.custom.filter=CustomAppender

Related

Swagger identifies rare endpoints in REST API

Some days ago I started a REST API in JavaEE 7, I implemented a single class with three methods and implemented succesfully Swagger and Swagger-UI in the project, which showed the three endpoints I implemented succesfully in the generated JSON.
However, I migrated to JavaEE 8, and after this change Swagger detects several unknown endpoints, like the "default" ones (this capture shows only part of all of them):
Investigating a bit I discovered that these endpoints may belong to a JPA REST API in Eclipselink implementation, as described here https://oracle-base.com/articles/misc/oracle-rest-data-services-ords-open-api-swagger-support and here https://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa004.htm#CHDFCFFA
Despite they appear in the generated JSON, all of them contain variable paths, so I can't access them following the path given by Swagger, even inventing some parameters like "version" using the webs above examples.
The Swagger version I use is v3, aka OpenAPI version. I specify OpenAPI properties with #OpenAPIDefinition in the endpoint class, which also contains a #Tag annotation to group them and the three methods contain #Operation tag with their own #ApiResponse. There is no more Swagger/OpenAPI annotations/files/classes written by me.
The question is, how can I make Swagger ignoring these endpoints?
Thanks
Finally I have found a solution. The case is that Swagger scanner engine scans the whole project, ignoring if the class and his methods have #Operation or not. If my hypothesis is true, some Eclipselink classes could have Swagger annotations (I'm not sure), so when Swagger scans, if finds them and add them to the JSON/YAML.
The solution is creating/adding to the existant openapi.yaml (it can have several names and can be in several locations, as enumerated here: https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-configuration#known-locations) this:
resourceClasses:
- com.path.to.your.package.Resource
prettyPrint: true
cacheTTL: 0 
scannerClass: io.swagger.v3.jaxrs2.integration.JaxrsAnnotationScanner
readAllResources: false
Instead of resourceClasses it can be written resourcePackages, and then it should be specified the whole package and the class in the same style as used to specify the package. To be honest, this property does not affect to my problem.
The solution comes on setting readAllResources to false. The reason is here, in a note: https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#operation
Blockquote
Note: swagger-jaxrs2 reader engine includes by default also methods of scanned resources which are not annotated with #Operation, as long as a jax-rs #Path is defined at class and/or method level, together with the http method annotation (#GET, #POST, etc).
I hope this solution serves for anyone if he/she has to face the same problem.

Where to get log4j2 configuration properties complete list

I am looking for a complete list of properties supported by log4j2. The log4j2 documentation at following link gives only a subset of properties.
https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties
For ex:
Delete files older than 30 days
appender.rolling.strategy.delete.ifLastModified.age = 30d
This is not listed in the manual. Any suggestions where I can find the list?
A full list of all log4j2 properties does not exist because configuration with properties is only one option among many (XML, JSON, YAML etc.).
Each log4j2 part is described with a list of configurable parameters it supports (e.g. https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender). The URI you are linking describes the rules which property names you have to choose to configure the parameters.
So the way you have to go is:
Select which function you have to use (e.g. RollingFileAppender)
Read the chapter of this function and select the parameters you want to configure
Use your linked URI to create you property based configuration with the property names for the parameters you want to configure

Orchard Contrib.DateTimeField missing style and script

`I've installed the DateTime Field module to Orchard and assigned two fields to my custom part, but when navigating to the Admin Edit page for the custom type implimenting the custom part, I recieve an error like this:
A 'stylesheet' named 'jQueryUtils_TimePicker' could not be found.
When looking in the Contrib.DateTime.cshtml View, I find that the following two resources are required, but I can't find them in the jQuery module's resource manifest.
Style: jQueryUtils_TimePicker
Script: jQueryUtils_TimePicker
Where are these meant to be defined and stored?
Thanks in advance.
P.S.
If I change both to jQueryUI_TimePicker (for which there is a script and style defined in the jquery module resource manifest), then it doesn't throws an error, but the time picker doesn't work.
Contrib.DateTimeField is obsolete since 1.4 so you shouldn't use it.
The DateTimeField has been integrated in Orchard.Fields has a core feature.

Google Custom Search: Issues retrieving promotions using file type exclusion in query

I'm having issues retrieving promotions when using file type exclusion in the query. I have tested with no file type exclusions in the query, and then I get my promotions in addition to a lot of results that I do not want.
Is there a workaround for this? Is it possible to set the file exclusion in the custom search engine console?
You can see how I have used the file type exclusion here
EDIT: Using param as_eq
I've also tried the param as_eq, e.g. &as_eq=filetype%3Apdf
Still same result!?

Removing commas from Grails' Scaffolds for Longs

I'm completely new to grails and I'm trying to deploy some simple applications using grails' scaffolding. I have a field in a domain class that stores barcodes as Longs. The default display in Grails' scaffolding is to display these Longs with commas separating every third numeral (e.g. 1,234,567). My searching of the documentation is getting me nowhere, is there a way of easily turning off this formatting until I can get a proper layout set up.
Thanks.
After generation of the scaffolded controllers and gsp files you could use the gsp tag g:formatNumber (see http://www.grails.org/GSP+Tag+-+formatNumber?xhr=true).
Maybe you can also customise the templates used for generation see docs for "grails install-templates" (http://www.grails.org/Artifact+and+Scaffolding+Templates) and get it working for dynamic scaffolding also... ymmv.
('tis my first post, be gentle)

Resources