Repository navigation
refactor(bbb-web): Log Conversion Process Output - #23321
Conversation
## Walkthrough
This change introduces unique identifier strings for each process handler instance used in the presentation conversion pipeline. Constructors for handler classes such as `ImageResizerHandler`, `ImageResolutionServiceHandler`, `Office2PdfConverterHandler`, `PdfPageCounterHandler`, `Png2SvgConversionHandler`, `SvgConversionHandler`, `Pdf2PngPageConverterHandler`, `AddNamespaceToSvgHandler`, and `PdfFontType3DetectorHandler` are updated to accept an `id` parameter, which is stored in a new private field. The `getIdTag()` method is overridden in each handler to return this identifier. Instantiations of these handlers throughout the codebase now provide descriptive, unique IDs based on job type, presentation ID, file name, or page number. Additionally, `AbstractCommandHandler` adds logging enhancements and public methods to access collected output.
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Client
participant MainService
participant Handler as ProcessHandler (with ID)
participant Process
Client->>MainService: Initiate conversion (e.g., resize, convert PDF)
MainService->>Handler: Instantiate Handler with unique ID
MainService->>Process: Start external process
Process->>Handler: Output events (stdout, stderr, exit)
Handler->>Handler: Collect output, log with ID tag
Handler->>MainService: Provide output via getStdout/getStdErr
MainService->>Client: Return resultsSuggested reviewers
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (6)
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/SvgConversionHandler.java (2)
17-21: LGTM! Consider adding null check for defensive programming.The addition of the
idfield and constructor is well-implemented. The field is appropriately marked asfinalensuring immutability after construction.Consider adding a null check in the constructor for more robust code:
public SvgConversionHandler(String id) { + if (id == null) { + throw new IllegalArgumentException("id cannot be null"); + } this.id = id; }
19-21: Consider adding null validation for the constructor parameter.The constructor accepts an
idparameter but doesn't validate if it's null. Consider adding a null check to prevent potential issues downstream.public SvgConversionHandler(String id) { + if (id == null) { + throw new IllegalArgumentException("ID cannot be null"); + } this.id = id; }bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PdfPageCounter.java (2)
45-45: Good implementation of handler identification.The descriptive ID string follows a consistent pattern and will improve process tracing. The combination of prefix and filename should provide sufficient uniqueness for debugging purposes.
Consider adding null safety for the filename:
-PdfPageCounterHandler pHandler = new PdfPageCounterHandler("pdfpagecount-" + presentationFile.getName()); +String fileName = presentationFile.getName(); +PdfPageCounterHandler pHandler = new PdfPageCounterHandler("pdfpagecount-" + (fileName != null ? fileName : "unknown"));
45-45: Consider null safety when generating the handler ID.The ID generation uses
presentationFile.getName()which could potentially return null, leading to an ID like "pdfpagecount-null". Consider adding a null check or fallback.-PdfPageCounterHandler pHandler = new PdfPageCounterHandler("pdfpagecount-" + presentationFile.getName()); +String fileName = presentationFile.getName() != null ? presentationFile.getName() : "unknown"; +PdfPageCounterHandler pHandler = new PdfPageCounterHandler("pdfpagecount-" + fileName);bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PngCreatorImp.java (1)
106-106: Good use of composite ID for uniqueness, but consider null safety.The ID generation pattern
"png2svg-" + pres.getId() + "-" + pageeffectively creates unique identifiers by combining presentation ID and page number. However, consider adding null safety forpres.getId().-Png2SvgConversionHandler pHandler = new Png2SvgConversionHandler("png2svg-" + pres.getId() + "-" + page); +String presId = pres.getId() != null ? pres.getId() : "unknown"; +Png2SvgConversionHandler pHandler = new Png2SvgConversionHandler("png2svg-" + presId + "-" + page);bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/ImageResolutionService.java (1)
43-43: Consistent implementation of the identifier pattern with null safety consideration.The change follows the established pattern with a descriptive prefix. Same as in
PdfPageCounter.java, consider null safety forpresentationFile.getName().-ImageResolutionServiceHandler imgResHandler = new ImageResolutionServiceHandler("imgresolution-" + presentationFile.getName()); +String fileName = presentationFile.getName() != null ? presentationFile.getName() : "unknown"; +ImageResolutionServiceHandler imgResHandler = new ImageResolutionServiceHandler("imgresolution-" + fileName);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/AbstractCommandHandler.java(2 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/AddNamespaceToSvgHandler.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/ImageResizerHandler.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/ImageResolutionServiceHandler.java(2 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/Office2PdfConverterHandler.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/Pdf2PngPageConverterHandler.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/PdfFontType3DetectorHandler.java(2 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/PdfPageCounterHandler.java(2 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/Png2SvgConversionHandler.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/SvgConversionHandler.java(2 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/ImageResizerImp.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/ImageResolutionService.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/Office2PdfPageConverter.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PdfPageCounter.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PngCreatorImp.java(1 hunks)bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SvgImageCreatorImp.java(5 hunks)
👮 Files not reviewed due to content moderation or server errors (4)
- bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/SvgConversionHandler.java
- bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PdfPageCounter.java
- bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PngCreatorImp.java
- bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/ImageResolutionService.java
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: build-package (others)
- GitHub Check: build-package (bbb-html5)
- GitHub Check: build-package (bbb-web)
- GitHub Check: build-package (bbb-graphql-server)
- GitHub Check: build-package (bbb-playback-record)
🔇 Additional comments (37)
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/SvgConversionHandler.java (3)
17-21: LGTM! Clean implementation of the ID-based logging enhancement.The addition of the
idfield and constructor follows good Java practices with proper encapsulation and immutability. ThegetIdTag()override correctly returns the stored identifier for enhanced process tracking.Also applies to: 63-66
63-66: Clean implementation of the getIdTag() method.The override correctly returns the stored identifier, following the expected pattern for process handler identification.
63-66: Clean implementation of the identifier pattern.The
getIdTag()method override correctly returns the stored identifier, following the established pattern for process handler identification.bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PdfPageCounter.java (1)
45-45: LGTM! Proper integration of unique handler identification.The ID string construction using
"pdfpagecount-" + presentationFile.getName()provides a descriptive and unique identifier for this PDF page counting process, aligning well with the logging enhancement objectives.bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/PngCreatorImp.java (2)
106-106: LGTM! Comprehensive ID construction for granular process tracking.The ID string
"png2svg-" + pres.getId() + "-" + pageprovides excellent granularity by including both presentation ID and page number, enabling precise tracking of individual page conversion processes.
106-106: Excellent use of contextual information for process identification.The ID string combines presentation ID and page number, which will be particularly valuable for debugging multi-page conversion processes. This follows the established pattern and provides meaningful traceability.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/ImageResolutionService.java (2)
43-43: LGTM! Consistent implementation of process identification.The ID string construction
"imgresolution-" + presentationFile.getName()follows the established pattern and provides clear identification for the image resolution detection process.
43-43: Consistent implementation of the identification pattern.The handler instantiation follows the same descriptive pattern established in other files, using a meaningful prefix and filename. This consistency across the codebase will make debugging and log analysis much easier.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/Office2PdfPageConverter.java (1)
66-66: LGTM! Proper implementation of unique identifier for handler.The ID construction using
"office2pdf-" + pres.getId()ensures uniqueness per presentation and aligns well with the logging enhancement objectives.bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/ImageResizerImp.java (2)
49-49: Good approach for generating unique job identifiers.Using
System.currentTimeMillis()provides sufficient uniqueness for logging and debugging purposes in this context.
57-57: LGTM! Proper handler instantiation with unique identifier.The handler is correctly instantiated with the generated job ID, enabling better process traceability.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/PdfPageCounterHandler.java (2)
35-39: Well-implemented constructor and field initialization.The
idfield is properly marked asfinaland initialized through the constructor, following good encapsulation practices.
55-58: Correct implementation of getIdTag() override.The method properly returns the stored identifier, enabling unique identification of this handler instance.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/ImageResizerHandler.java (2)
30-34: Clean implementation of identifier support.The constructor and field initialization follow the same pattern as other handlers, maintaining consistency across the codebase.
36-39: Proper getIdTag() implementation.The override correctly returns the stored identifier, enabling unique process identification for logging purposes.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/PdfFontType3DetectorHandler.java (2)
30-34: LGTM! Clean implementation of unique identifier support.The addition of the
idfield and constructor follows proper Java practices with immutable field design and clear initialization.
48-51: Proper override implementation.The
getIdTag()method override correctly returns the identifier, enabling the logging enhancement functionality.bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/ImageResolutionServiceHandler.java (2)
29-33: Consistent implementation of identifier support.The
idfield and constructor implementation follows the same clean pattern established across the handler classes.
72-75: Correct getIdTag() override.The method override properly implements the identifier access for logging purposes.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/Office2PdfConverterHandler.java (2)
30-34: Well-implemented identifier functionality.The
idfield and constructor maintain consistency with the logging enhancement pattern across all handler classes.
36-39: Proper getIdTag() implementation.The override correctly provides access to the unique identifier for logging purposes.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/AddNamespaceToSvgHandler.java (2)
9-13: Excellent completion of the identifier pattern.The
idfield and constructor implementation completes the consistent refactoring across all handler classes for enhanced logging capabilities.
15-18: Consistent getIdTag() override.The method override maintains the established pattern, ensuring uniform identifier access across the conversion pipeline.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/Pdf2PngPageConverterHandler.java (2)
28-32: Clean implementation of unique identifier pattern.The addition of the
idfield and constructor follows the consistent pattern being applied across all handlers for improved process traceability and logging.
34-37: Proper override of getIdTag() method.The method correctly returns the stored identifier, enabling the AbstractCommandHandler's enhanced logging to use meaningful process IDs.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SvgImageCreatorImp.java (5)
65-65: Well-designed ID pattern for font detection process.The ID pattern
"font3pdf-" + pres.getId() + "-" + pageprovides clear traceability linking the process to specific presentation and page.
104-104: Consistent ID pattern for PNG to SVG conversion.The ID
"png2svg-" + pres.getId() + "-" + pagemaintains consistency with other handlers and provides clear process identification.
149-149: Descriptive ID for SVG conversion process.The ID
"pdf2svg-" + pres.getId() + "-" + pageclearly identifies the conversion type and associated content.
230-230: Clear identification for PDF to PNG conversion.The ID
"pdf2png-" + pres.getId() + "-" + pagefollows the established pattern and provides excellent traceability.
294-294: Appropriate ID for SVG namespace processing.The ID
"svg-namespace-" + pres.getId() + "-" + pageclearly identifies this specific post-processing step.bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/Png2SvgConversionHandler.java (2)
29-33: Consistent ID field implementation.The ID field and constructor follow the same pattern as other handlers, maintaining consistency across the codebase.
35-38: Proper getIdTag() override.The method correctly returns the stored ID for use in logging and process identification.
bbb-common-web/src/main/java/org/bigbluebutton/presentation/handlers/AbstractCommandHandler.java (5)
54-59: Enhanced stdout handling with defensive programming.The addition of null and remaining bytes checks, along with debug logging using process ID tags, significantly improves visibility into process execution while maintaining robustness.
66-69: Improved stderr handling with error-level logging.The enhanced stderr processing with error-level logging using ID tags will make debugging conversion issues much easier.
75-75: Valuable process exit logging.Adding exit code logging with process ID context provides crucial information for diagnosing conversion failures.
106-112: Useful public accessor methods for collected output.These methods provide clean access to the collected stdout and stderr output, which aligns perfectly with the PR objectives of improving process output visibility.
114-120: Well-designed getIdTag() method with appropriate fallback.The method provides a sensible fallback to "unknown-pid" when the process isn't available, ensuring logging always has a meaningful identifier. Subclasses can override this to provide more descriptive IDs.
|
Thank you for adding these! |
I don't have any specific example of an error log since I don't have any presentations that cause errors in conversion to test with. Every run of one of the process does output a blank error message. It is just standard and not indicative of an actual problem. You can also upload a presentation and look at the bbb-web logs, assuming you have the log level set to debug, you can see the logs from each process. An example of what a process log looks like is |
|
If possible, please add the meetingId and presId in the logs so we can easily filter the logs. Thanks. |
…ndlers/AbstractCommandHandler.java Co-authored-by: Gustavo Trott <[email protected]>
…ndlers/AbstractCommandHandler.java Co-authored-by: Gustavo Trott <[email protected]>
|
Automated tests Summary✅ All the CI tests have passed! |



What does this PR do?
Adds support for logging conversion process output from the handlers that wrap the processes. Data is logged to the bbb-web.log. Log data coming from stdout is logged at the debug level to not pollute the bbb-web logs. Log data from stderr is logged at the error level. Each process is also assigned a unique ID to make tracing any issues easier.
Motivation
This additional logging will give up better insight into the functioning of the conversion processes and make debugging any issues much easier.