Week 1 Log4J/Design Patterns Flashcards

1
Q

Log4J

A

is a logging tool that helps us to keep track of whats going on inside of a code.
Log4J is highly configurable, through external configurations at runtime. It views the logging process in terms of levels of priority and offers mechanism to direct logging information to a variety of destinations such as data bases, file, console, Unix Syslog

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why log5j is better than sysout

A

Log4J is better than using sysout all the time because sysout is a synchronized method that is very costly in terms of processing. Also sysout is not a debugging tool.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A good logging format should let you decide a couple of things

A

Level - what to log (going from worst to least bad)

  • OFF
  • FATAL
  • ERROR
  • WARN
  • INFO
  • DEBUG
  • TRACE
  • ALL

Formatting/layout - how to log

  • define layout
  • date time style
  • can output in html format

Appenders - where to log

  • log files - in a file for reference later
  • console - lost of console out put
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Levels explained

A

ALL - all levels including custom levels.
TRACE - designates finer grained info event than the debug.
DEBUG - designates fine grained info events that are most useful to debut at application.
INFO -designates info messages that highlight the progress of the application a coarse grained level
WARN - designates harmful situations
ERROR - designates error events that might still allow the application to continue running.
FATAL -designates very severe events that will presumably lead the application to abort.
OFF - the highest possible rank and is intended to turn off logging.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

log4J.properties

A

where properties (logging configuration in a file) are kept.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

log4J features

A
  • thread safe
  • high speed optimization
  • multiple appenders support
  • customization
  • various logging levels
  • layout class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

log4J Advantages

A
  • Quick debugging
  • Easy maintenance
  • Structured Storage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

log4J Disadvantages

A
  • Slows down app

- Scrolling blindness, due to config file being too verbose.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

core objects

A

Loggers
Appenders
Layouts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Loggers

A

Responsible for capturing logging information

  • Register class to logger
  • Gathers the logging info an are captured in the namespace hierarchy.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Appenders

A

Publish the logging information to the retrospective destination also lower level object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Layouts

A

Styles the logging info for readability (ie time stamp.)-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Support Core Objects

A

Level
Filters
Object Renderer
Log Manager

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Level

A

defines granularity and priority of logging info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Filter

A

analyze and decide whether to keep the logged info. Appenders can use multiple filters . tells the Appender whether or not to print the loop to the respective destination.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Object Renderer

A

provides the string representation of the logging information.

17
Q

Log Manager

A

read the config parameter.

18
Q

What is a Singleton?

A

ensures a class has only once instance and provides global access to it.

syntax
private static Singleton instance;

static method  to get teh unique  instance if it does not exist then we will create it. 
public  static  synchronized Singleton  getInstance(){
if (instance == null){
instance = new Singleton();
}
return instance;
}
19
Q

Factory

A

factories create an object w/o exposing creation logic to the client.

20
Q

Lambda Expressions

A

Disembody function, methods that don’t belong to a class. Lamba expressions basically express instance of functional interfaces. Lamda expressions implement the only abstract function and therefore implements functional interfaces.