karaf log level for a bundle - apache-karaf

How do I set a different log level for a specific bundle from karaf> prompt?
log:set TRACE sets TRACE level logging for all. I want INFO/DEBUG for ROOT and TRACE level logging for a specific bundle.

How about:
log:set <level> <package>
typed in the console karaf.

You can't from prompt. For this you'll need to alter the org.ops4j.pax.logging.cfg file. Either by altering the file directly or by using the config:* commands.

Related

Quarkus Flyway Placeholders Configuration issue

I am having trouble getting quarkus.flyway.placeholders working in my Quarkus app.
I have this line defined in my application.properties file
quarkus.flyway.placeholders.myuser=my_user
in my sql file I have this line
GRANT DELETE, INSERT, SELECT, UPDATE ON survey.answers TO ${myuser};
the error I'm getting is
org.flywaydb.core.api.FlywayException: No value provided for placeholder: ${myuser}. Check your configuration!
Here are the things I've tried:
upgraded to Quarkus 1.13.6.Final
Tried setting
quarkus.flyway.placeholder-prefix=#[
quarkus.flyway.placeholder-suffix=]
As shown in the integration test:
https://github.com/quarkusio/quarkus/tree/main/integration-tests/flyway
Thank you
Matthew
I see you have a typo in your configuration or sql script.
With the following settings:
quarkus.flyway.placeholder-prefix=#[
quarkus.flyway.placeholder-suffix=]
In your sql file the placeholder should be defined as a #[myuser], not $[myuser]
You can also change the placeholder-prefix definition in your application.properties file to support prefix you already have in the sql file.
At one time I have two flyway users.
quarkus.flyway.owner this one has create privileges
quarkus.flyway.user this one has fewer privileges.
This item was not associated with the user role.
quarkus.flyway.placeholders.myuser=my_user
After changing it to quarkus.flyway.owner.placeholders.myuser=my_user
it started working.

Configure a symfony database connection from ini file?

On the server I need to deploy my symfony 5.2.4 application, the database configuration is defined in an ini file for which the path is set as an environment variable.
The way I have done it right now is to run composer dump-env dev then in .env.local.php, add some code to load the inifile, parse it, then construct my database url and set DATABASE_URL to that value like that:
$inifile = parse_ini_file($_SERVER["DB_INI_PATH"]);
$databaseurl = 'mysql://'.$inifile["user"].':'.$inifile["password"].'#'.$inifile["host"].':'.$inifile["port"].'/'.$inifile["db"];
But this means that I have some code in this file that can't be versioned (because it also contains my APP_SECRET value), and anytime I need to redump my env, I will need to readd that custom code.
I have not found a proper place to add this ini file decoding process in my symfony app, so I am looking for any advice on the proper way to do that, in a way that would be versionable.
You can write your doctrine config in php and you will have access to environment variables. You can add your logic in "config/packages/prod/doctrine.php". The example in the docs shows how to set doctrine.dbal.url go here and click on the php tab for the example code: https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables

Error when starting the Application Insights Agent for Java

I have configured my environment as described in this link for the Application Insights Agent for Java: https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-agent
I configure an environment variable so that the Java Options are set with the option "-javaagent:" set to the directory where the agent jar file is located and the associated AI-Agent.xml file. I continue to get a startup error:
"[Fatal Error] AI-Agent.xml:1:10: The processing instruction target matching [xX][mM][lL]" is not allowed."
The configuration file contains the default values from the above link. I have also tried other times where I have removed everything except for the outer tags but still get the same error so I do not believe the config file is the issue. Does anyone know what this message means?

How to use environment variable in xcconfig #include?

in my project, I want to refer to an other xcconfig file, located in InDesign SDK. As this SDK may be installed at different locations, depending upon the machine, I prefer to declare an environment variable for locating it.
Nest step is obviously to use variable (aptly named ID_CS5_SDK_DIR) in my xcconfig include directive.
Unfortunatly, when I try the simple
// InDesign sdk project build settings (based on common build settings)
#include "$(ID_CS5_SDK_ROOT)/build/mac/prj/_shared_build_settings/common.xcconfig"
XCode throws me a
[WARN]AutocatPlugin.xcconfig line 7: Unable to find included file "$(ID_CS5_SDK_ROOT)/build/mac/prj/_shared_build_settings/common.xcconfig"
How can I make it work ?
I've been trying to do this too and also came to the conclusion that it is not possible.
I once tried to achieve that and came to the conclusion that you can't. I would be happy if someone proves us it's possible though then delete my answer
It seems like .xcconfig files can only DEFINE and set value to environment variables (which prevail only throughout the build session) but not USE or evaluate environment variables.
Maybe it is because .xcconfig files serve as a base layer of build-settings, and are not parsed.
Unfortunately this is not possible, but instead of making one include the other, you can use two different xcconfig files per target. Just select one for the Project and one for the Target.
If you put the environment variable in /etc/config/launchd.conf and then reboot it will be accessible to the .xcconfig file.
Short Instructions for experienced users:
Edit the read-only file /etc/launchd.conf and add 'setenv VARIABLENAME /FOLDER/PATH' to the file, then reboot.
Steps For Inexperienced Users
Open Application/Utilities/Terminal, and entersudo nano /etc/launchd.conf
Create the Environment Variable by adding a line like setenv VARIABLENAME FOLDER/PATH and then pressing ENTER.
Save the file using Ctrl-O, Ctrl-M, (Possibly Ctrl-Y to overwrite), then Ctrl-X to exit the editor.
(Optional) type cat /etc/launchd.conf to see that your changes are present
Restart your computer. (Logoff doesn't work)
You can now access the variable in your .xcconfig file as$(VARIABLENAME)
Notes:
This creates a GLOBAL environment variable, accessible to all users. It probably doesn't make sense to set this to something in your home directory (e.g ~/MyFolder). If you do this, however, you need to use the full pathname, such as /Users/MyUserName/MyFolder).
References:
Stack Overflow - Setting Environment Variables in OSX
Stack Overflow - Are there any differences between /etc and /private /etc

Log4j in Websphere

I recently take over a web application project using websphere and log4j running under AIX. To create a development environment, I setup all the components in windows, using eclipse to compile a WAR file and deploy it.
All is working fine except that log file is not created.
I changed the log file in log4j.properties from something like in below and and give everyone full access permission to the directory:
log4j.appender.F1.File=/abc/def/logs/admin.log
to
log4j.appender.F1.File=c:/logs/admin.log
What else can I check?
I create a simple standalone testapp which use the same log4j.properties and it can create the log file, but when the servlet deployed to websphere, it doesn't work. Please help! Thanks!
Ok, I think this article should help you. It seems that WebSphere CE uses log4j by default and controls it with a global properties file. There is a section on how to use application-specific properties files.
Here is what I try and do to troubleshoot similar issues.
Turn on log4j debugging to see where it actually picks up the file from. You need evidence of which file is picked up (so turning the debug on is a worthwhile activity) This provides you information with what log4j is trying to do to locate the configuration file.
-Dlog4j.debug=true
I would not hardcode the log4j location in the code. Instead I
would use the log4j.configuration System property and state that in
the JVM arguments. This way even I don't need to touch my code.
-Dlog4j.configuration=file:///home/manglu/log4j.properties
I would use this approach irrespective of the runtime server that I use (be it Tomcat or WAS CE or WAS)
Hope this helps
I suggest you use environment variables set on your server like this :
You must access the admin console of your server.
Under custom properties
Server_path=/abc/def/logs
In your log4j, use this : {$server_path}/log.txt
Make sure the user running the app has access to that directory.

Resources