Skip to content

Commit

Permalink
Add log messages in FileConfigStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Aug 16, 2023
1 parent 39415a3 commit 4d93c72
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.io.FileOutputStream;

import org.mozilla.jss.netscape.security.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.netscape.certsrv.base.EBaseException;
import com.netscape.cmscore.apps.CMS;
Expand All @@ -39,6 +41,8 @@
*/
public class FileConfigStorage extends ConfigStorage {

public final static Logger logger = LoggerFactory.getLogger(FileConfigStorage.class);

private File mFile;

/**
Expand Down Expand Up @@ -76,6 +80,16 @@ public void load(ConfigStore config) throws Exception {
*/
@Override
public void commit(ConfigStore config, boolean createBackup) throws EBaseException {

StackTraceElement[] ste = Thread.currentThread().getStackTrace();
if (ste.length > 3) {
// log the code that calls ConfigStore.commit()
StackTraceElement st = ste[3];
String className = st.getClassName();
className = className.substring(className.lastIndexOf('.') + 1);
logger.info("{}: Storing config into {}", className, mFile.getPath());
}

if (createBackup) {
File newName = new File(mFile.getPath() + "." +
Long.toString(System.currentTimeMillis()));
Expand Down

0 comments on commit 4d93c72

Please sign in to comment.