Springboot 2.2.5 and logging in file - spring-boot

i'm don't find the way to logging in file with spring 2.2.5
I tried in the application.properties
logging.file.name=C:/log/app.log
or
logging.file.path=C:/log
But everytime it created the file, but don't write anything in.
Why ? I don't find any tutorial on web which work

You can set the absolute path with following code
logging.path=D:\logs\logfile.txt
If the folder doesn't exist it gets created. On Windows you have to work with \ as seperator, while on Linux and Mac you need / as seperator. Check create dir and write permission on specified path.
You should either specify logging.file or logging.path, but not both ( when both are specified, logging.path is ignored and only logging.file is considered).

Related

SpringBoot Config Server file separator issue

I have configued Spring Boot Config server (2.4.1 version) integrated with Git repository.
Config looks valid, there is no issue during loading files from git, however when i point to
localhoast:port/application/dev
i get
{"name":"application","profiles":["dev"],"label":null,"version":"7e67e69e075b05d9fa50e3255deef7585ed658c7","state":null,"propertySources":[]}
I turned on logging everything and I discovered, that config server downloaded file correctly and saved file somewhere in temp folder like:
(1) C:/Users/username/AppData/Local/Temp/config-repo-5493381163789847226/
however NativeEnironmentRepository is expecting that it will be in:
(2) C:\Users\username\AppData\Local\Temp\config-repo-5493381163789847226\
which is also valid windows path.
When I turn on debuggin I found out that
NativeEnvironmentRepository check path (1)
against pattern (2) and it fails. So in result
"propertySources":[]
is empty.
Is this a bug on SpringBoot config server? or should I setup/change something in configuration?
It looks like NativeEnvironmentRepository should use system File.separator...
I had same issue with spring boot 2.4.1 in windows platform. It is solved by spring 2.4.2.snapshot.
Spring 2.4.1 worked properly in linux ubuntu. I dont know what is the problem.

multiple parameters not getting passed when I start my spring boot application in command line

I want to override certain properties during deployment of my spring boot application.
when I try the following it works
sudo /etc/init.d/myapp start --app.env=prod
I see the app.env is correctly set to prod (my /health just echoes this values)
however when I set more than one property it did not work,
sudo /etc/init.d/myapp start --app.env=prod --version=2.3.4
I see only app.env is correctly set. the version value is not overridden.
why is it so? what is the right way to pass multiple parameters.
NOTE: I want to pass username and password for datasources. but for testing purposes, I kept it simple to override these properties.
You would want to read the section around Customizing the startup script. Specifically that you can include a myapp.conf file beside the jar file. In that .conf file is a JAVA_OPTS variable. You would then use -Dapp.env=prod -Dversion=2.3.4

How to connect eclipse IDE to apache Ignite?

I have written Ignite hello world program in Eclipse and want to connect it to localhost(127.0.0.1). But it is giving me error for example "ignite.xml file path is invalid"
I am starting ignition as follows,
try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {}
But I got error like:
Spring XML configuration path is invalid: examples/config/example-ignite.xml.
How do I fix it?
You have the following options:
Provide the absolute file path.
Set IGNITE_HOME system property or environment variable, put the file in this folder and provide the path relative to the home.
Add the configuration file on classpath under META-INF and provide the path relative to it.
The last option is usually the most convenient for the applications with an embedded Ignite node.

spring boot log file being overwritten on restart

I'm using https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html to start my spring-boot application on ubuntu 14.04 and it's working great except my log file gets overwritten whenever I restart the app. Probably it's something simple... but how can I configure that behaviour? I'm just using the default console logging to /var/log/app_name.log. If I pass in the logback "--logging.file=..." config to the init script, it logs both to the default as well as this file and this file doesn't get overwritten. Thanks!

Location of hue.ini to set share_jobs in CDH 4.7

I'm attempting to set the share_jobs setting described HERE to false.
The documentation HERE says to visit http://myserver:port/dump_config to find the location of the HUE config. For me it gives /var/run/cloudera-scm-agent/process/73-hue-HUE_SERVER/.
As you may guess from it being in /var/run/ the directory is recreated every time on boot so changes to the hue.ini are not saved and do not seem to affect the config listed at http://myserver:port/dump_config.
I ran find / -name hue.ini to see if there was another hue.ini to change. It returned:
/var/run/cloudera-scm-agent/process/73-hue-HUE_SERVER/hue.ini
/var/run/cloudera-scm-agent/process/69-hue-BEESWAX_SERVER/hue.ini
/opt/cloudera/parcels/CDH-4.7.0-1.cdh4.7.0.p0.40/share/hue/desktop/conf/hue.ini
/opt/cloudera/parcels/CDH-4.7.0-1.cdh4.7.0.p0.40/etc/hue/hue.ini
I've changed the config in each of these files to no avail. Where exactly is the hue.ini that I need to change?
I've also been looking around the Cloudera Manager for the jobbrowser section in the configuration but I have not been able to find it.
hue.ini file inside the server configuration directory (/var/run/cloudera-scm-agent/process/73-hue-HUE_SERVER/) should be modified that too not directly, should use CM instead. Location of the configuration directory will be changed during restart or applying new configurations.
Usually important service configurations will be listed in the cloudera manager configuration section. Configuration properties which are unimportant or new may not be listed, in that case these properties are supplied in the safety_val sections.
Go to CM Hue service configuration section search for hue_safety_valve_server.ini, then add the following
[jobbrowser]
share_jobs=false
Save and restart. Now if you go and check the /var/run/cloudera-scm-agent/process/XXX-hue-HUE_SERVER/hue.ini file you can see the change. What ever contents you are giving in safety_val will get appended to hue.ini file.

Resources