Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging to FastFoodApp controller, logging template to applicatio… #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ajmorgs
Copy link
Collaborator

@ajmorgs ajmorgs commented Nov 7, 2021

Added logging, logging leve, and logging templates to application.properties so different levels of loggin can be done from application properties.

Put the following in your application.properties if not including in version control:

logging.level.org.springframework=DEBUG
logging.level.com.howtodoinjava=DEBUG

#output to a temp_folder/file
logging.file.name=${java.io.tmpdir}/application.log

Logging pattern for the console

logging.pattern.console= %d{yyyy-MM-dd HH:mm:ss} - %msg%n

Logging pattern for file

logging.pattern.file= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%

@ajmorgs
Copy link
Collaborator Author

ajmorgs commented Nov 7, 2021

To reduce overall technical debt, rename CartOrder to Order, then delete ShoppingCart class and ShoppingCartController, as well as OrderHistory and OrderHistoryController. Differentiate between the order statuses by adding a Status field, Differentiate recent orders by returning based on OrderID. Could add CartID as primary key until order is actually placed, then populate and use OrderID. Adding endpoints as need for OrderHistory, etc.

Can use the same method names for updates etc, by adding an interface and then specify the implementation of those methods in the class.

@ajmorgs
Copy link
Collaborator Author

ajmorgs commented Nov 7, 2021

Removed contructors in order class as they were not needed because of lombok. Added javadoc to Order class

@ajmorgs
Copy link
Collaborator Author

ajmorgs commented Nov 7, 2021

The program is aesthetically pleasing.
It was available in UC Github on time?
The program could be organized better to reduce complexity and technical debt. See comments above.
The program does compile.
Links to three commits you pushed to your group's main/master branch during Sprint 2.
1387119
ce7c463
aa9e7c7

@@ -70,8 +70,8 @@ public ResponseEntity fetchAllFood(){
return new ResponseEntity(allFood, headers, HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
/*TO DO Logging*/
logger.warning(e.getMessage());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd bump this to error.

Comment on lines +14 to +15
private String orderId;
private String cartId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these used anywhere?

This appears to be an incomplete feature. In a code review, focus on reducing technical debt of existing code. Avoid adding new, incomplete functionality .

  1. Only features that meet the Definition of Done should be merged to Master.
  2. Unused code is clutter, which increases technical debt.

@discospiff
Copy link

Logging: definitely a good idea.

For the class names, I'm not clear on how changing them reduces technical debt. Cite sources to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants