The below code shows hot to read the list of resources(files) from a classpath folder and subfolder.Below is the example code
import java.io.*;
import java.net.URL;
import java.nio.file.Files;
import java.util.*;
public class ReadResourceFiles {
public static void main(String[] args) throws IOException {
...
Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts
undefined
202
In this blog, lets check how we can push the data to solace mq or solace queue using JMS. Message queues are the endpoints which guarantees you the delivery of a message without fail.So to implement the Java code to push messages, first add the below dependency in pom.xml file if you are using the maven project in...
undefined
201
We are using the HashMap to store the character as key and count
of times it is repeated as value.
package com.string.codebyakram;
import java.util.HashMap;
public class NonReapingCahr {
public static void main(String[] args) {
String string = "hello";
System.out.println(findNonReapingCahr(string));
}
...
You can create multiple logs file by using same log4j properties file or you can send logs to multiple files by using same log4j file.
Add this below to your log4j properties file.
log4j.rootLogger=TRACE, stdout
log4j.appender.dataLogs=org.apache.log4j.FileAppender
log4j.appender.dataLogs.File=logs/logFile1.log
log4j.appender.dataLogs.layout=org.apache.log4j.PatternLayout
log4j.appender.dataLogs.layout.ConversionPattern=%d...
undefined
201
package com.avaya.deletelogs;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.List;
public class DeleteLogs {
private String baseDir = "/opt/java/IVRLog";
private int daysBack = 4;
public void invokeProcess() {
getFolders();
}
public void getFolders() {
try...