I assume you have one or more Arduinos, are trying to do MIDI control, and want to know how to debug with the MIDI library having commandeered the hardware serial port.
One approach is to use I2C or SPI to communicate with a second Arduino, which uses its serial port to deliver debugging data to a host system. See Nick Gammon's excellent page Debugging using SPI/I2C and a second processor (gammon.com.au forum id=11329), which illustrates communication between two Arduinos, using one of them as a slave to forward information sent by I2C or SPI from a system being debugged.
Another approach might be to use a serial bridge. I don't know the ins and outs of this or exactly what it does but have read that, for example, the Hairless bridge (which is an open-sourced software package) can display both sides of MIDI communication, possibly depending on use of
Serial.print. You could designate certain note sequences as standing for various debugging cases.
A third approach is use of Arduino software serial to send debugging data to a serial port on your host system. This would use some Arduino pins other than the hardware Rx, Tx pins.
Edit 1: Pin Usage –
For approach 1, using I2C ties up two specific pins, SDA and SCK. These are shared with other I2C devices, if any. SPI typically shares three signals – SCLK, MOSI, and MISO – among all SPI devices, and generates one SS signal per device. For pinout and protocol details, see Nick Gammon's well-organized and clearly-illustrated I2C and SPI pages.
Approach 2 would use no extra pins.
Approach 3 would use one or two extra pins: one for half-duplex or output-only communication (which may be adequate for debugging), two for separate Rx, Tx lines. Compared to hardware serial, software serial is CPU-intensive, does not support as-high data rates, and has a higher error rate. It should work ok for light-weight debugging output, such as occasional text to show what tests succeeded or failed or what branch was taken, or values of a few variables.