Can I know why it doesn't give out the output for below code since there's no any error? - jdbc

package labexercise2;
import java.sql.*;
public class LabExercise2
{
public static void main (String [] args) throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
System.out.println ("Driver Loaded");
Connection connection= DriverManager.getConnection("jdbc:mysql://localhost/restaurant?"+ "user=root&password=");
System.out.println ("Database connected");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT MenuID, MenuName, Type, Cuisine FROM menu WHERE Price BETWEEN 7 AND 13");
while (rs.next()){
System.out.println(rs.getString("MenuID") + " : " +
rs.getString("MenuName") + " : " +
rs.getString("Type") + " : " +
rs.getString("Cuisine") + " : " +
rs.getString("Price")); }
connection.close();
}
}
Can I know why it doesn't give out the output for below code since there's no any error?
Any help will be appreciated

i think you missed port number in DriverManager.getConnection argument,it should be as following.
Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant?"+ "user=root&password=");

package labexercise2;
import java.sql.*;
public class LabExercise2
{
public static void main (String [] args) throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
System.out.println ("Driver Loaded");
Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/restaurant?"+ "user=root&password=");
System.out.println ("Database connected");
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM menu WHERE Price BETWEEN 7.00 AND 13.00");
while (rs.next()){
System.out.println(rs.getString("MenuID") + " : " +
rs.getString("MenuName") + " : " +
rs.getString("Type") + " : " +
rs.getString("Cuisine") + " : " +
rs.getString("Price")); }
conn.close();
}
}

can you try following code instead connection.close();
if (statement != null) {
statement.close();
}
if (connection!= null) {
connection.close();
}

i have mocked and tested your code, it's working for me as explained below.
import java.sql.*;
public class LabExercise2 {
public static void main (String [] args) throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
System.out.println ("Driver Loaded");
Connection connection= DriverManager.getConnection("jdbc:mysql://localhost/restaurant?"+ "user=root&password=root");
System.out.println ("Database connected");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM menu WHERE Price BETWEEN 7 AND 13");
while (rs.next()){
System.out.println(rs.getString("MenuID") + " : " +
rs.getString("MenuName") + " : " +
rs.getString("Type") + " : " +
rs.getString("Cuisine") + " : " +
rs.getLong("Price")); }
connection.close();
}
}

Related

Oracle Analytics Server Web service for get user info

i have installed the Oracle Analytics Server 5.9(New version of Oracle BI) in my linux server and we migrate the configurations and the meta data and repository from old version to this one.
also we had a .NET app that work with the web service of Oracle BI to get and set the user and groups of security realm in the domain of BI.
but now in Oracle Analytics Server, the web service does not work properly.
in the local domain it does work properly but when we deploy on the server of Analytics Server, it does not work properly.
my source code is :
#WebService
public class UserGroupMemberCls {
private static JMXConnector jmxConnector = null;
private static MBeanServerConnection mBeanServerConnection = null;
private static String webLogicHostname = "192.168.24.63";
private static String webLogicPort = "9500";
private static String webLogicUsername = "weblogic";
private static String webLogicPassword = "123456";
.
.
.
.
#WebMethod(exclude = true)
public static List getListOfGroups() throws Exception {
ObjectName securityMBeanName1 = new ObjectName("Security:Name=myrealmDefaultAuthenticator");
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST2");
try {
initConnection(webLogicHostname, webLogicPort);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST13");
List<String> allUsers = new ArrayList();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST14");
String cursor =
(String) mBeanServerConnection.invoke(securityMBeanName1, "listGroups",
new Object[] { "*", Integer.valueOf(100) },
new String[] { "java.lang.String", "java.lang.Integer" });
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST15");
boolean haveCurrent =
((Boolean) mBeanServerConnection.invoke(securityMBeanName1, "haveCurrent", new Object[] { cursor },
new String[] { "java.lang.String" })).booleanValue();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST16");
while (haveCurrent) {
String currentName =
(String) mBeanServerConnection.invoke(securityMBeanName1, "getCurrentName", new Object[] { cursor },
new String[] { "java.lang.String" });
allUsers.add(currentName);
mBeanServerConnection.invoke(securityMBeanName1, "advance", new Object[] { cursor },
new String[] { "java.lang.String" });
haveCurrent =
((Boolean) mBeanServerConnection.invoke(securityMBeanName1, "haveCurrent", new Object[] { cursor },
new String[] { "java.lang.String" })).booleanValue();
}
mBeanServerConnection.invoke(securityMBeanName1, "close", new Object[] { cursor },
new String[] { String.class.getName() });
jmxConnector.close();
jmxConnector = null;
return allUsers;
} catch (Exception ex) {
ex.printStackTrace();
jmxConnector.close();
throw new RuntimeException(ex);
}
}
.
.
.
.
#WebMethod(exclude = true)
public static void initConnection(String hostname, String portString) throws IOException, MalformedURLException {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST3");
Integer portInteger = Integer.valueOf(portString);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST4");
int port = portInteger.intValue();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST5");
String mserver = "/weblogic.management.mbeanservers.runtime";
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TES6");
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "hostname : " + hostname);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "port : " + port);
JMXServiceURL serviceURL =
new JMXServiceURL("service:jmx:iiop:///jndi/iiop://" + hostname + ":" + port + mserver);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "serviceURL : " + serviceURL);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST7");
Hashtable<Object, Object> h = new Hashtable<Object, Object>();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "h1 : " + h);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST8");
String[] credentials = { webLogicUsername, webLogicPassword };
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST9");
h.put("jmx.remote.credentials", credentials);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "h2 : " + h);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST10");
try {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "(Map) h : " + (Map) h);
jmxConnector = JMXConnectorFactory.connect(serviceURL, (Map) h);
} catch (IOException ioe) {
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
.log(Level.SEVERE,
"MESSAGE : " + ioe.getMessage() + " >>>> " + "STACKTRACE : " + ioe.getStackTrace() +
" >>>> " + " CAUSE : " + ioe.getCause());
// TODO: Add catch code
ioe.printStackTrace();
}
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "jmxConnector : " + jmxConnector);
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST11");
mBeanServerConnection = jmxConnector.getMBeanServerConnection();
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.SEVERE, "TEST12");
}
and the output is :

How to trim video with start and end pos of seekbar using FFmpeg android?

String[] cmd = new String[]{"-ss", startTrim + ".00", "-t", endTrim + ".00", "-noaccurate_seek", "-i", videoPath, "-codec", "copy", "-avoid_negative_ts", "1", outputAudioMux};
private void trimVideo(ProgressDialog progressDialog) {
outputAudioMux = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()
+ "/VidEffectsFilter" + "/" + new SimpleDateFormat("ddMMyyyy_HHmmss").format(new Date())
+ "filter_apply.mp4";
if (startTrim.equals("")) {
startTrim = "00:00:00";
}
if (endTrim.equals("")) {
endTrim = timeTrim(player.getDuration());
}
String[] cmd = new String[]{"-ss", startTrim + ".00", "-t", endTrim + ".00", "-noaccurate_seek", "-i", videoPath, "-codec", "copy", "-avoid_negative_ts", "1", outputAudioMux};
execFFmpegBinary1(cmd, progressDialog);
}
private void execFFmpegBinary1(final String[] command, ProgressDialog prpg) {
ProgressDialog progressDialog = prpg;
try {
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
#Override
public void onFailure(String s) {
progressDialog.dismiss();
Toast.makeText(PlayerActivity.this, "Fail to generate video", Toast.LENGTH_SHORT).show();
Log.d(TAG, "FAILED with output : " + s);
}
#Override
public void onSuccess(String s) {
Log.d(TAG, "SUCCESS wgith output : " + s);
String finalPath = outputAudioMux;
videoPath = outputAudioMux;
Toast.makeText(PlayerActivity.this, "Storage Path =" + finalPath, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(PlayerActivity.this, ShareVideoActivity.class);
intent.putExtra("pathGPU", finalPath);
startActivity(intent);
finish();
MediaScannerConnection.scanFile(PlayerActivity.this, new String[]{finalPath}, new String[]{"mp4"}, null);
}
#Override
public void onProgress(String s) {
Log.d(TAG, "Started gcommand : ffmpeg " + command);
progressDialog.setMessage("Please Wait video triming...");
}
#Override
public void onStart() {
Log.d(TAG, "Startedf command : ffmpeg " + command);
}
#Override
public void onFinish() {
Log.d(TAG, "Finished f command : ffmpeg " + command);
progressDialog.dismiss();
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// do nothing for now
}
}

when i start .jar app on mac do nothing

I have made a simple JavaFx application, wich read/write the txt file (the code is below). I have tested it on windows platform (7 and higher).
After i gave app my friend for test on Mac. But when we run it, just do nothing. The GUI did not appear.
I tried run it through terminal (just "drug and drop" the icon to terminal, then enter in teminal. I don't know did i do right?) and terminal returned message "Permission denied". Can somebody explain what is require to run application, and what is not permitted exactly?
I found the similar question there but it have not answer...
Code:
import javafx.application.*;
import javafx.concurrent.Task;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.control.SplitPane;
import javafx.scene.text.Font;
import javafx.stage.*;
import javafx.scene.layout.*;
import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class Main extends Application {
static Properties props;
static double fontSize;
static String charsetName;
static long mills;
static String delimiter;
static String pathToDictionary;
static String pathErrLog;
static {
String pathFileProps = System.getProperty("user.dir") + "\\props.txt";
props = new Properties();
try {
FileInputStream fis = new FileInputStream(pathFileProps);
props.load(fis);
fontSize = Double.parseDouble(props.getProperty("Font"));
charsetName = props.getProperty("Charset");
mills = Long.parseLong(props.getProperty("mills"));
delimiter = props.getProperty("delimiter");
pathToDictionary = props.getProperty("dict.path");
fis.close();
} catch (IOException e) {
try {
props.put("Font", "20");
props.put("Charset", "UTF-8");
props.put("mills", "1000");
props.put("delimiter", "\t");
props.put("dict.path", System.getProperty("user.dir") + "\\dict.txt");
System.out.println("dictPath:" + System.getProperty("user.dir") + "\\dict.txt");
System.setProperty("file.encoding", "UTF-8");
FileOutputStream fos = new FileOutputStream(pathFileProps);
props.store(fos
, "Props description:" + "\n" +
"Font" + "\t\t" + "size of font's words " + "\n" +
"Charset" + "\t" + "charset of file-dictionary" + "\n" +
"mills" + "\t\t" + "per animations in milliseconds" + "\n" +
"delimiter" + "\t" + "delimiter between a pair words in string: eng<->rus \"<->\" is delimiter there." + "\n" +
"dict.path" + "\t" + "path to file-dictionary. Use \"/\"-symbol in path. Ex: C:/temp/dict.txt" + "\n" +
"\t\t\t" + "Use only eng symbols to set path!" + "\n" +
"\tYou can change only values!\n");
fos.close();
System.exit(0);
} catch (IOException e1) {
errPrint(e1,"Ошибка создания файла: " + pathFileProps + "\n");
}
}
}
ArrayList<String> dictionary = new ArrayList<>();
public static void errPrint(Exception exc, String note) {
if (pathErrLog == null) {
pathErrLog = System.getProperty("user.dir") + "\\errors.log";
}
try {
PrintWriter outFile = new PrintWriter(new FileWriter(pathErrLog, true));
outFile.println(note);
exc.printStackTrace(outFile);
outFile.close();
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
launch(args);
}
public void init() throws IOException {
try {
BufferedReader reader = new BufferedReader(new FileReader(pathToDictionary));
int cnt = 0;
while (reader.ready()) {
String line = new String(reader.readLine().getBytes(), Charset.forName(charsetName));
dictionary.add(line);
}
} catch (FileNotFoundException e) {
errPrint(e,"Не найден файл " + pathToDictionary);
} catch (IOException e) {
errPrint(e,"Ошибка чтения файла " + pathToDictionary);
}
}
public void start(Stage myStage) {
myStage.setTitle("WordsLearner");
SplitPane sp = new SplitPane();
sp.setOrientation(Orientation.VERTICAL);
Label labelUp = new Label();
Label labelDw = new Label();
labelUp.setFont(new Font(fontSize));
labelDw.setFont(new Font(fontSize));
Scene scene = new Scene(sp, 600, 200);
myStage.setScene(scene);
final StackPane sp1 = new StackPane();
sp1.getChildren().add(labelUp);
sp1.setAlignment(Pos.BOTTOM_CENTER);
final StackPane sp2 = new StackPane();
sp2.getChildren().add(labelDw);
sp2.setAlignment(Pos.TOP_CENTER);
final boolean[] flag = {true};
sp.setOnMouseClicked(event -> {
Task<Void> task = new Task<Void>() {
#Override
public Void call() throws Exception {
if (flag[0]) {
flag[0] = false;
final String[] str = new String[1];
final String[] eng = new String[1];
final String[] rus = new String[1];
while (true) {
Platform.runLater(() -> {
try {
str[0] = dictionary.get(ThreadLocalRandom.current().nextInt(0, dictionary.size()));
eng[0] = str[0].split(delimiter)[0];
rus[0] = str[0].split(delimiter)[1];
labelUp.setText(eng[0]);
labelDw.setText(rus[0]);
} catch (Exception e) {
System.exit(-1);
}
});
Thread.sleep(mills);
}
}
return null;
}
};
new Thread(task).start();
});
sp.getItems().addAll(sp1, sp2);
sp.setDividerPositions(0.5f, 0.5f);
myStage.show();
}
public void stop() {
System.exit(0);
}
}

Spring aop and aspectj

How to store all the logged method calls in database of a single session using spring aop and aspectj ?
In the following code i will get the method names i need to capture them and store in database for an individual session.
#Aspect
#Component
public class LoggingAspect {
// #Autowired
// private SessionFactory sessionFactory;
//
// #Autowired
// private ActionRolesService actionRolesService;
private Logger logger = LoggerFactory.getLogger(getClass());
#Pointcut(" execution(java.lang.String com.bis.sourcelead.entity..*.*()) && "
+ "!execution(java.lang.String com.bis.sourcelead.entity..*.set*()) && "
+ "!execution(java.lang.String com.bis.sourcelead.entity..*.get*())")
private void intercepterMethod() {
}
#Pointcut("execution(#javax.inject.Inject * com.bis.sourcelead.web..*.*(..))")
public void methodAnnotatedWithInjectAndInDemoPackage() {
}
#Before("intercepterMethod()")
public void logAround(JoinPoint joinPoint) throws Throwable {
logger.info("********** Action class Before Method Excution ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.info("Method name : " + joinPoint.getSignature().getName());
logger.info("Parameters name : " + Arrays.toString(joinPoint.getArgs()));
}
#Before("execution(* com.bis.sourcelead.service..*.*(..))")
public void logBeforeService(JoinPoint joinPoint) throws Throwable {
logger.info("**********Service Layer Before Method Excution ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.info("Method name : " + joinPoint.getSignature().getName());
logger.info("Parameters name : " + Arrays.toString(joinPoint.getArgs()));
}
#AfterReturning(pointcut = "execution(* com.bis.sourcelead.service..*.*(..))", returning = "result")
public void logAfterReturningService(JoinPoint joinPoint, Object result) {
logger.info("********** Service Layer After Method Exectution ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.info("Method name : " + joinPoint.getSignature().getName());
logger.info("Method returned value : " + result);
}
#AfterThrowing(pointcut = "execution(* com.bis.sourcelead.service.*.*(..))", throwing = "error")
public void logAfterThrowingService(JoinPoint joinPoint, Throwable error) {
logger.info("********** Service Layer Method Throwing Error ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.error("Method name : " + joinPoint.getSignature().getName());
logger.error("Exception : " + error);
}
#AfterThrowing(pointcut = "execution(* com.bis.sourcelead.dao.*.*(..))", throwing = "error")
public void logAfterThrowingDao(JoinPoint joinPoint, Throwable error) {
logger.info("********** Dao Layer Method Throwing Error ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.error("Method name : " + joinPoint.getSignature().getName());
logger.error("Exception : " + error);
}
#Around("execution(* com.bis.sourcelead.dao..*.*(..))")
public Object logAroundDao(ProceedingJoinPoint joinPoint) throws Throwable {
Object result = null;
logger.info("********** Dao Layer Before Method Excution ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.info("Method name : " + joinPoint.getSignature().getName());
logger.info("Parameters name : " + Arrays.toString(joinPoint.getArgs()));
long start = System.currentTimeMillis();
//result = joinPoint.proceed(); //continue on the intercepted method
result = joinPoint.proceed(joinPoint.getArgs()); //continue on the intercepted method
long elapsedTime = System.currentTimeMillis() - start;
logger.info("********** Dao Layer After Method Excution ************");
logger.info("Method execution time: " + elapsedTime + " milliseconds.");
return result;
}
#Before("execution(* com.bis.sourcelead.rest..*.*(..)) && methodAnnotatedWithInjectAndInDemoPackage() ")
public void logBeforeWebService(JoinPoint joinPoint) throws Throwable {
logger.info("**********Web Service Layer Before Method Excution ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.info("Method name : " + joinPoint.getSignature().getName());
logger.info("Parameters name : " + Arrays.toString(joinPoint.getArgs()));
System.out.print("Executed the #Injected method: "
+ joinPoint.getSignature() + " with value(s): ");
for (Object object : joinPoint.getArgs()) {
System.out.print(object);
}
System.out.println();
}
#AfterReturning(pointcut = "execution(* com.bis.sourcelead.rest..*.*(..))", returning = "result")
public void logAfterReturningWebService(JoinPoint joinPoint, Object result) {
logger.info("********** Web Service Layer After Method Exectution ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.info("Method name : " + joinPoint.getSignature().getName());
logger.info("Method returned value : " + result);
// try {
// if(joinPoint.getSignature().getName().equalsIgnoreCase("createUser"))
// logger.info("pradeep::"+actionRolesService.getActionNameUsingMethodName(joinPoint.getSignature().getName()));
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
#AfterThrowing(pointcut = "execution(* com.bis.sourcelead.rest.*.*(..))", throwing = "error")
public void logAfterThrowingWebService(JoinPoint joinPoint, Throwable error) {
logger.info("********** Web Service Layer Method Throwing Error ************");
logger.info("Class name : " + joinPoint.getTarget().getClass().getSimpleName());
logger.error("Method name : " + joinPoint.getSignature().getName());
logger.error("Exception : " + error);
}
}
//end class

Use Spring AOP and get respective class name in log file

I am using Spring AOP for logging purpose. Everything is working but in the log i am only getting the name of the Aspect class. I want the respective name of the class to be printed. Here is the code snippet. What changes are required in the following code to suffice my requirement.
private static final Logger logger = Logger.getLogger(LogginAspect.class);
#After("execution(* com.app.c2pc...(..))")
public void logAfter(JoinPoint joinPoint) {
logger.info("After executing method : " + joinPoint.getSignature().getName());
logger.info("***************************************************************************");
}
#Before("execution(* com.app.c2pc..*.*(..))")
public void logBefore(JoinPoint joinPoint) {
logger.info("***************************************************************************");
logger.info("Before executing method : " + joinPoint.getSignature().getName());
}
#Around("execution(* com.app.c2pc..*.*(..)) && !execution(* com.app.c2pc.login.LoginController.*(..)) ")
public Object logAround(ProceedingJoinPoint pjp) throws Throwable {
long start = System.currentTimeMillis();
Object clazz = pjp.getTarget().getClass().getName();
String methodName = pjp.getSignature().getName();
logger.info("Entering Class " + clazz + " With Method Name " + methodName);
Object[] obj = pjp.getArgs();
int i = 0;
try {
for (Object o : obj) {
logger.info(++i + " : Parameter Name :" + (null != o ? o.toString() : ""));
}
} catch (Exception e) {
e.printStackTrace();
}
Object output = pjp.proceed(pjp.getArgs());
logger.info("Excecution Completed for method : " + methodName + " in Class : " + clazz + " with result "
+ output);
long elapsedTime = System.currentTimeMillis() - start;
logger.info("Execution time for method : " + methodName + " in Class : " + clazz + " : " + elapsedTime
+ " milliseconds.");
return output;
}
#AfterThrowing(pointcut = "execution(* com.app.c2pc..*.*(..))", throwing = "error")
public void logAfterThrowing(JoinPoint joinPoint, Throwable error) {
logger.info("Exception thrown by method : " + joinPoint.getSignature().getName());
logger.info("Exception name : " + error);
}
#AfterReturning(pointcut = "execution(* com.app.c2pc..*.*(..))", returning = "result")
public void logAfterReturning(JoinPoint joinPoint, Object result) {
logger.info("Method : " + joinPoint.getSignature().getName() + " returned value is : " + result);
}
This is the o/p i get in the log file:-
2016-07-20 23:41:20 | | INFO LogginAspect:23 - After executing method : checkSubmitEvalFlag
2016-07-20 23:41:20 | | INFO LogginAspect:24 - ***************************************************************************
2016-07-20 23:41:20 | | INFO LogginAspect:70 - Method : checkSubmitEvalFlag returned value is : 0
2016-07-20 23:41:20 | | INFO LogginAspect:40 - Entering Class com.app.c2pc.scie.daoImpl.PbdDAOImpl$$EnhancerBySpringCGLIB$$688f6ece With Method Name getBackUpUserDetails
2016-07-20 23:41:20 | | INFO LogginAspect:45 - 1 : Parameter Name :com.app.c2pc.scie.bean.SearchCriteriaBean#77ef5b02
you can use "joinPoint.getTarget().getClass().getName()" to get fully qualified class name like "com.abc.pqr.MyClass"
you can use "joinPoint.getTarget().getClass().getSimpleName()" to get only class name like "MyClass".

Resources