Log4j2, how to deal with acces denied exception - log4j2

I'm using RollingFile appender to store logs in file.
Unfortunately, sometimes logs file is created from root account,
as a result of which no logs are saved into file.
An exception occurs during:
org.apache.logging.log4j.core.appender.rolling.RollingFileManager.RollingFileManagerFactory#createManager
triggered
"ERROR RollingFileManager (target/logs/file.log) java.io.FileNotFoundException: target\logs\file.log (Access is denied) java.io.FileNotFoundException: target\logs\file.log (Access is denied)"
I would like to prevent application run in this situation.
I've tried to use FailoverAppender connected to RollingFileAppender, but it's not triggered at all.
Any ideas how to deal with it ?

I ran to the same problem and it was because of a mistake in my log4j2.properies.
I set appender.rolling.fileName to an alreay existed directory/file
I recommend u to double check ur configuration and search for the same mistake maybe.
hope it is helpful for the others who have same issue

Related

Log org.springframework

I have a non-Spring appliation. However, we are pulling in spring-security-config and spring-security-web. We use Log4j and have a log4j.properties file.
We want to log all the output from 'org.springframework' with the 'trace' log level.
We do not have an application.properties file, but can create one if we need one.
So, when I run my non-Spring app, all my code logs properyly, but I am not seeing anything from org.springframework in my logs.
Since Spring Security pulls in Spring Core, we created an application.properties on the classpath. We then setup a logging.file property to our log file. Then we setup some other logging property files to see if that would help. We also set debug=true as well.
So, I'll keep trying ....
Thanks in advance!
So, I found the problem. The logs were going to another log file in a different directory. I believe this is because it was a container log and not an application log.
Hope this helps someone else out.

setting global allocation limit HANA

When I try to set the global allocation limit for HANA I get the error message
Transaction rolled back by internal error:exception 70000000:ste:: exception type file system manage /usr/sap.../global.ini ;Reason Write error
I assume I do not have the privilege to write in the global.ini file. Can I edit the global.ini file with the DB OS user? How can it be resolved? Any help is appreciated. Thanks a lot.
Have you checked whether the file system where the .ini file is stored is full by any chance? The file permissions should be fine and the error message would be different if they weren't.

Build Error Issue "Couldn't update module cache session file derived data Module cache"

I was running my first program after updating Xcode to version 7.3 and I keep getting this build error
Couldn't update module cache session file '/Users/admin/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation': You don’t have permission to save the file “Session.modulevalidation” in the folder “ModuleCache”.
I have tried solving this by setting the permission of my home directory and the folder to read & write but I still get the same error. Can anyone suggestions on how to fix this?
I fixed it, turns out the only thing I did not do was set read and write permission for staff on Session.modulevalidation
Hope it helps anyone having a similar problem.
I had permission issues for the mentioned folder which sorted the issues for me.
I fixed it by setting read and write permission for staff on Session.modulevalidation

SonarQube Service Starts, Runs and then Stops?

I have a Windows 2012 R2 server and I managed to install the SonarQube 5.4 server as a Windows Service. I also set up a user so the service can actually start without the infamous "It started then stopped" error a lot of people seem to get. Before installing the server as a windows service, I checked that it worked using StartSonar.bat and it did work just fine, so I was confident when I made it into a service.
But when I try to access http://localhost:9000 there is nothing there, and it appears that shortly after starting the service it stops without any message at all. I can't tell if this is because I try to access the site (which gives me ERR_EMPTY_RESPONSEin Google Chrome) or if it just closes down after a short while.
Anyone got any insight?
I'm a beginner. I came across the same issue and fixed it.
Ensure that the database is running.
My log file (located at sonarqube_home_dir/logs/sonar.log) included the following statement.
Caused by: org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-176]
Since I'm using the default database, I commented below lines
#sonar.jdbc.username=***
#sonar.jdbc.password=***
at sonarqube_home_dir/conf/sonar.properties.
This must happen due to many reasons like connection problems, permission problems so First, you have to see the logs. /sonarqube-7.6/logs$ tailf sonar.log. then you can find the reason. Once I had the same problem so I did like that. my error is something Directory does not exist: lib/jdbc/mysql
org.sonar.process.MessageException: Directory does not exist: lib/jdbc/mysql reason is I uninstall MySQL and remove all folders name contains "MySQL".
just check whether port 9001 already in used, stop it if already in used.

Gerrit - Application Error - Intraline difference not available due to server error

For one of our gerrit projects, while navigating the file differences we get this error:
Application Error
Intraline difference not available due to server error
[Continue]
It doesn't happen for all projects, currently we've detected the error on only one project.
I looked on Google and on the gerrit documentation. Found a reference on their source code, but don't know what causes it and how it can be resolved.
The web page with the error contains a "Continue" button. Once clicked it will take you to the file you selected, but the error is annoying.
Do you know how to fix this?
That is caused while cache the intraline difference of one file, when compared between two commits. The default timeout value is 5 seconds. If the file is huge, and computation takes longer than the timeout, the worker thread is terminated, an error message is shown, and no intraline difference is displayed for the file pair.
A solution could fix this.
Add config in gerrit.conf.
[cache "diff_intraline"]
timeout = 15000 ms # Or other time length as you want.
restart Gerrit service
run SSH command "gerrit flush-caches", using a user with ViewCaches global capability.
ssh -p port userxxx#host gerrit flush-caches
Then it would work.
Cause of the error:
It is a result of Gerrit taking too long to diff the file, and marking the diff in one of its caches as non-available.
The relevant error log is here:
[2012-06-08 11:14:08,547] WARN com.google.gerrit.server.patch.IntraLineLoader : 5000 ms timeout reached for IntraLineDiff in project xxxxxxx on commit 354dd67ad54578cf801d8cda64a4ae8484ebb0b7 for path xxxxxxx.java comparing bf9fbc21520af7bfd0841c8b9f955ca6e215b059..f6b9c7992c12cfdca253acd033966f98f70f3543. Killing IntraLineDiff-6

Resources