Posts

Showing posts from 2016

Configure MDC with SLF4j Logback file in java

This article is all about how you configure MDC logs with SLF4J and logback. 1. Maven POM dependencies : Please add maven dependencies as given below.        <!-- Logging with SLF4J & LogBack --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.13</version> </dependency> 2. Configure logback.xml file <?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="30 seconds"> <property name="DEV_HOME" value="c:/logs" />     <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">         <resetJUL>true</resetJUL>     </con...

Struts 1 with JSON response

You want to explore struts 1.X with ajax based application which returns JSON as a response, you can go following public repository. https://github.com/youdhveer/struts1

Load csv file data into MySQL table

Suppose we have a device table along with following columns. id(integer),device(varchar),device_data(varchar). Now suppose you want to upload data from a device.csv file like given below. --------------------------------------------------- "id","device","device_data" "1","A1","this is test device, model-11" "2","A2","this is test device, model-12" "3","A3","this is test device, model-13" "4","A4","this is test device, model-14" ---------------------------------------------------- Use following command to insert these values from csv file to table with casting id value from text to integer. LOAD DATA INFILE 'D:\device.csv' INTO TABLE device  FIELDS TERMINATED BY  ','  ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES (@id, device, device_data) SET id= CONVERT( @id, UNSIGNED...