Is there a way to add new parameters to custom log levels in log4j2 ?
As I saw, we can only change the log level name, but the parameters remains the same.
https://logging.apache.org/log4j/2.x/manual/customloglevels.html
Related
I'm working on a simple JIRA Server plugin that will prevent a transition from occurring if a certain custom field has not been set. I have created a new workflow validator with atlas-create-jira-plugin-module and tailored the validate function to fit my needs. Strangely, when I add this new validator to a transition via the workflow editor, it appears in the list of validations with the wrong description. It is showing the description from the default condition, "Only users with Resolve Issues" permission can execute this transition".
I've been following along with this tutorial: https://developer.atlassian.com/server/jira/platform/creating-workflow-extensions/
I also came across this similar tutorial: https://www.j-tricks.com/tutorials/workflow-validator
In my atlassian-plugin.xml I made sure to define a "view" velocity resource:
<workflow-validator key="custom-field-is-set-validator" name="Custom Field Is Set Validator" i18n-name-key="custom-field-is-set-validator.name" class="com.ngc.jira.plugins.workflow.CustomFieldIsSetValidatorFactory">
<description key="custom-field-is-set-validator.description">Validation to require that a custom field be given a value.</description>
<validator-class>com.ngc.jira.plugins.workflow.CustomFieldIsSetValidator</validator-class>
<resource type="velocity" name="view" location="templates/validators/custom-field-is-set-validator.vm"/>
<resource type="velocity" name="input-parameters" location="templates/validators/custom-field-is-set-validator-input.vm"/>
<resource type="velocity" name="edit-parameters" location="templates/validators/custom-field-is-set-validator-input.vm"/>
</workflow-validator>
And the contents of custom-field-is-set-validator.vm are as follows:
Only if the custom field <strong>$field</strong> has be set.
As a sanity check, I created a workflow condition and applied my velocity (vm) resource as the view template for it. It shows up correctly within this context!
However, when I try to use the same velocity resource for my workflow validator, the admin page still displays the validator as "Only users with Resolve Issues permission can execute this transition" instead of using my description.
What am I missing? Thanks!
Screenshot showing the built-in condition
Screenshot showing my validator that is wrongly appearing as the same condition
I wrote an O'Reilly book Practical Jira Plugins back in 2011 that has a validator example. The source for this is at https://bitbucket.org/mdoar/practical-jira-plugins/src/default/ (and the book is Out There).
But frankly these days I'd use ScriptRunner, JMWE or other plugins that let you write custom workflow things. But don't let that stop you learning it! Good luck
It turns out, I had copied/pasted a piece of code from my workflow condition that needed to be tweaked for a workflow validator. I was trying to cast to a ConditionDescriptor when I should have been casting to a ValidatorDescriptor:
Bad:
if (!(descriptor instanceof ConditionDescriptor)) {
throw new IllegalArgumentException("Descriptor must be a ConditionDescriptor.");
}
ConditionDescriptor conditionDescriptor = (ConditionDescriptor) descriptor;
Good:
if (!(descriptor instanceof ValidatorDescriptor)) {
throw new IllegalArgumentException("Descriptor must be a ValidatorDescriptor.");
}
ValidatorDescriptor validatorDescriptor = (ValidatorDescriptor) descriptor;
Pretty neat that instead of completely breaking my plugin, it ended up displaying a different description altogether. ;)
I am new to Serilog and to Seq. Sorry for the beginner question.
I want to have an output template that seems to be available in Serilog for the Console, but I can't seem to configure it in the WriteTo.Seq parameters.
Am I missing something or is this not available or is there another way to do this?
I was hoping to create a template constant and keep the format all in one place.
TIA
Seq uses signals with tagged properties for this.
Pick an event that has a property you want to show beside the message,
click the green "tick" to "Show as tag", and then
save the resulting signal so that you can apply it when you want to show the property inline.
The signal can be set as a default for your user account in (your username) > Preferences.
I have a filter that modifies the request headers, and a filter that logs the request. Because the logging filter is applied liberally, I have a testNG listener which appends this implicitly (overriding onStart). The header filter needs to be explicitly called, so that any unattended side effects of this can be carefully handled.
I want the logging filter to log the real request - but after the request is logged, it gets modified (because onStart adds the logging filter, followed by the test which adds the header modifier filter).
Is there a way to force the logging filter to be the last filter run, without having to have each test that uses it to retrieve the filter list and append this at the beginning?
Currently there's no such option in REST Assured.
Looks like 'ordered' filters have been added as of version 3.0.2
https://github.com/rest-assured/rest-assured/wiki/Usage#ordered-filters
I have a report that is being passed parameters through the URL, but would like to have the report load by default before the user has to click the 'View Report' button. I have rs:Command=Render in the URL but this doesn't seem to be doing it. Is there another tag that I am missing here? The URL is currently as follows:
https://server/subfolder/viewreport.aspx?Report%Name&rs:Command=Render&Parameter1=Value1&Parameter2=Value2
The report comes up with the appropriate values selected by default, as passed above, but it does not run until I hit View Report. Do I need to specify all the other parameters in the report through the URL in order for it to run by default, even though those parameters already have default values?
Found it, the report renders automatically as long as all parameters have a 'Default' value specified. Two text parameters in the report needed to have their default expressions set to =""
I am trying to modify the messages.properties file for form input validated by a Command Object that is in specified in the controller. The output I get from the standard error message (that I modified slightly to assure I was hitting that specific one) is:
email cannot be empty test class com.dashboard.RegisterController$DashboardUserRegistrationCommand
but no variant of com.dashboard.RegisterController$DashboardUserRegistrationCommand.null.message
works
I am wondering what the correct specification should be.
Try to put DashboardUserRegistrationCommand outside (below) of RegisterController but still in the same file. Then com.dashboard.DashboardUserRegistrationCommand.. should work.
i.e. com.dashboard.DashboardUserRegistrationCommand.message.nullable
The typical layout of error messages is:
${packageName}.${className}.${propertyName}.${errorCode}
So for your example it would be:
com.dashboard.DashboardUserRegistrationCommand.message.nullable
In the Grails Reference on the right hand side there is a header titled 'Constraints'. On each page of the specific constraints listed under that header the ${errorCode} value is listed at the bottom of the page.
And sometimes you have to restart a run-app to get new messages to populate in a Grails project.
Just to help others in the future, I had the same issues and my problem was the way I was defining my key, I use now:
For default messages:
default.null.message=Write a value for {0}
For commmand error messages:
my.package.UserCommand.name.nullable=Please tell us your name
It is strange that sometimes you use nullable and sometimes you use null. The best thing is going to the Grails Constraints directly and check how is it done for example:
http://grails.org/doc/latest/ref/Constraints/nullable.html